{"record":{"id":"b49f373b713e39d7","repo":"Lightning-AI/pytorch-lightning","slug":"richprogressbar-requires-rich-10-2-2-insta","errorCode":null,"errorMessage":"`RichProgressBar` requires `rich` >= 10.2.2. Install it by running `pip install -U rich`.","messagePattern":"`RichProgressBar` requires `rich` >= 10\\.2\\.2\\. Install it by running `pip install -U rich`\\.","errorType":"exception","errorClass":"ModuleNotFoundError","httpStatus":null,"severity":"error","filePath":"src/lightning/pytorch/callbacks/progress/rich_progress.py","lineNumber":310,"sourceCode":"        ModuleNotFoundError:\n            If required `rich` package is not installed on the device.\n\n    Note:\n        PyCharm users will need to enable “emulate terminal” in output console option in\n        run/debug configuration to see styled output.\n        Reference: https://rich.readthedocs.io/en/latest/introduction.html#requirements\n\n    \"\"\"\n\n    def __init__(\n        self,\n        refresh_rate: int = 100,\n        leave: bool = False,\n        theme: RichProgressBarTheme = RichProgressBarTheme(),\n        console_kwargs: Optional[dict[str, Any]] = None,\n    ) -> None:\n        if not _RICH_AVAILABLE:\n            raise ModuleNotFoundError(\n                \"`RichProgressBar` requires `rich` >= 10.2.2. Install it by running `pip install -U rich`.\"\n            )\n\n        super().__init__()\n        self._refresh_rate: int = refresh_rate\n        self._leave: bool = leave\n        self._console: Optional[Console] = None\n        self._console_kwargs = console_kwargs or {}\n        self._enabled: bool = True\n        self.progress: Optional[CustomProgress] = None\n        self.train_progress_bar_id: Optional[TaskID]\n        self.val_sanity_progress_bar_id: Optional[TaskID] = None\n        self.val_progress_bar_id: Optional[TaskID]\n        self.test_progress_bar_id: Optional[TaskID]\n        self.predict_progress_bar_id: Optional[TaskID]\n        self._reset_progress_bar_ids()\n        self._metric_component: Optional[MetricsTextColumn] = None\n        self._progress_stopped: bool = False","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/pytorch/callbacks/progress/rich_progress.py#L292-L328","documentation":"RichProgressBar is an optional progress-bar callback that depends on the third-party `rich` library (>=10.2.2). Lightning marks it unavailable at import time when rich isn't installed; constructing the callback then raises ModuleNotFoundError with pip install instructions.","triggerScenarios":"Instantiating RichProgressBar() in an environment where the `rich` package is missing or older than 10.2.2 (the import guard _RICH_AVAILABLE is False); typical in minimal/SLURM/container environments where only core requirements are installed.","commonSituations":"Running on a cluster or Docker image built from requirements without the 'rich' extra; using a fresh virtualenv with only torch and lightning; CI environments that skip optional dependencies.","solutions":["Run `pip install -U rich` (or `pip install lightning[rich]` if using the extras syntax) to install/upgrade rich >= 10.2.2","Alternatively fall back to the default TQDMProgressBar, which needs no extra dependency","Pin rich>=10.2.2 in your project requirements so environments are reproducible"],"exampleFix":"# before (ModuleNotFoundError)\ntrainer = pl.Trainer(callbacks=[RichProgressBar()])\n# after\n# pip install -U rich\ntrainer = pl.Trainer(callbacks=[RichProgressBar()])\n# or fallback:\nfrom lightning.pytorch.callbacks import TQDMProgressBar\ntrainer = pl.Trainer(callbacks=[TQDMProgressBar()])","handlingStrategy":"fallback","validationCode":"from lightning.fabric.utilities.imports import _RICH_AVAILABLE\nif not _RICH_AVAILABLE:\n    progress = TQDMProgressBar()\nelse:\n    progress = RichProgressBar()","typeGuard":"try:\n    import rich  # noqa\n    _RICH_OK = rich.__version__ >= '10.2.2'\nexcept ImportError:\n    _RICH_OK = False","tryCatchPattern":"try:\n    bar = RichProgressBar()\nexcept ModuleNotFoundError:\n    bar = TQDMProgressBar()","preventionTips":["Declare rich>=10.2.2 in project requirements","Degrade gracefully to TQDMProgressBar in cluster/CI environments"],"tags":["pytorch-lightning","rich","missing-dependency","progress-bar"],"backgroundTag":"missing-optional-dependency","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}