pytorch-lightning: ModuleNotFoundError: No module named 'rich.progress_bar'

🐛 Bug

Updated pl from 1.4.9 to 1.5.2 and got this

Traceback (most recent call last):
File "train.py", line 9, in <module>
from pytorch_lightning import Trainer, seed_everything
File ".venv/lib/python3.8/site-packages/pytorch_lightning/__init__.py", line 20, in <module>
from pytorch_lightning.callbacks import Callback  # noqa: E402
File ".venv/lib/python3.8/site-packages/pytorch_lightning/callbacks/__init__.py", line 25, in <module>
from pytorch_lightning.callbacks.progress import ProgressBar, ProgressBarBase, RichProgressBar, TQDMProgressBar
File ".venv/lib/python3.8/site-packages/pytorch_lightning/callbacks/progress/__init__.py", line 23, in <module>
from pytorch_lightning.callbacks.progress.rich_progress import RichProgressBar  # noqa: F401
File ".venv/lib/python3.8/site-packages/pytorch_lightning/callbacks/progress/rich_progress.py", line 26, in <module>
from rich.progress_bar import ProgressBar
ModuleNotFoundError: No module named 'rich.progress_bar'

P.s. import rich works, but rich.progress_bar - no

Expected behavior

You can also fill out the list below manually. –>

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (19 by maintainers)

Most upvoted comments

Well I’m hereby to congratulate someone who wrote this piece of code.

@Vozf Please stay respectful in our public forum. The community contributes new code to the project every day. There are bugs and this is normal. We thoroughly review changes but we don’t blame anybody for when bugs surface. As of right now, this ticket is still open, which means investigation will continue. Your debugging effort is certainly appreciated.

@Vozf #10762 will fix the issue

_RICH_AVAILABLE should be False as

_RICH_AVAILABLE = _module_available("rich") and _compare_version("rich", operator.ge, "10.2.2")

And your rich version was less than 10.2.2. So, the import shouldn’t have happened.

It probably would, but raising an exception with asking to install an “optional” dependency doesn’t sound like a good idea. Throwing a warning with setting _RICH_AVAILABLE to False sounds better

I think so, but I can’t be sure. I can test it on a branch or fork