Skip to content

Commit c20b7fb

Browse files
committed
Raise exception if rich is less than 10.2.2 (#10839)
1 parent a418140 commit c20b7fb

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
66

7-
## [1.5.4] - 2021-12-07
7+
## [1.5.5] - 2021-12-07
88

99
### Fixed
1010

1111
- Disabled batch_size extraction for torchmetric instances because they accumulate the metrics internally ([#10815](https://github.com/PyTorchLightning/pytorch-lightning/pull/10815))
1212
- Fixed an issue with `SignalConnector` not restoring the default signal handlers on teardown when running on SLURM or with fault-tolerant training enabled ([#10611](https://github.com/PyTorchLightning/pytorch-lightning/pull/10611))
1313
- Fixed `SignalConnector._has_already_handler` check for callable type ([#10483](https://github.com/PyTorchLightning/pytorch-lightning/pull/10483))
14+
- Improved exception message if `rich` version is less than `10.2.2` ([#10839](https://github.com/PyTorchLightning/pytorch-lightning/pull/10839))
1415

1516

1617
## [1.5.4] - 2021-11-30

pytorch_lightning/callbacks/progress/rich_progress.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
from typing import Any, Optional, Union
1818

1919
from pytorch_lightning.callbacks.progress.base import ProgressBarBase
20-
from pytorch_lightning.utilities import _RICH_AVAILABLE
20+
from pytorch_lightning.utilities.exceptions import MisconfigurationException
21+
from pytorch_lightning.utilities.imports import _RICH_AVAILABLE
2122

2223
Task, Style = None, None
2324
if _RICH_AVAILABLE:
@@ -222,9 +223,10 @@ def __init__(
222223
theme: RichProgressBarTheme = RichProgressBarTheme(),
223224
) -> None:
224225
if not _RICH_AVAILABLE:
225-
raise ModuleNotFoundError(
226-
"`RichProgressBar` requires `rich` to be installed. Install it by running `pip install -U rich`."
226+
raise MisconfigurationException(
227+
"`RichProgressBar` requires `rich` >= 10.2.2. Install it by running `pip install -U rich`."
227228
)
229+
228230
super().__init__()
229231
self._refresh_rate_per_second: int = refresh_rate_per_second
230232
self._leave: bool = leave

tests/callbacks/test_rich_progress_bar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def predict_dataloader(self):
8585

8686
def test_rich_progress_bar_import_error():
8787
if not _RICH_AVAILABLE:
88-
with pytest.raises(ImportError, match="`RichProgressBar` requires `rich` to be installed."):
88+
with pytest.raises(ImportError, match="`RichProgressBar` requires `rich` >= 10.2.2."):
8989
Trainer(callbacks=RichProgressBar())
9090

9191

0 commit comments

Comments
 (0)