Skip to content

Commit 447b110

Browse files
awaelchlilantiga
authored andcommitted
Fix rich import error in Google Colab (#17156)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Carlos Mocholí <[email protected]> (cherry picked from commit 66e2111)
1 parent 2525e7f commit 447b110

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/pytorch_lightning/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
2020

2121
- Fixed `num_nodes` not being set for `DDPFullyShardedNativeStrategy` ([#17160](https://github.com/Lightning-AI/lightning/pull/17160))
2222

23+
- Fixed the availability check for `rich` that prevented Lightning to be imported in Google Colab ([#17156](https://github.com/Lightning-AI/lightning/pull/17156))
24+
25+
2326

2427
- The `psutil` package is now required for CPU monitoring ([#17010](https://github.com/Lightning-AI/lightning/pull/17010))
2528

src/pytorch_lightning/callbacks/rich_model_summary.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
from typing import List, Tuple
1515

1616
from pytorch_lightning.callbacks import ModelSummary
17-
from pytorch_lightning.utilities.imports import _RICH_AVAILABLE
17+
from pytorch_lightning.callbacks.progress.rich_progress import _RICH_AVAILABLE
1818
from pytorch_lightning.utilities.model_summary import get_human_readable_count
1919

20-
if _RICH_AVAILABLE:
20+
if _RICH_AVAILABLE: # type: ignore[has-type]
2121
from rich import get_console
2222
from rich.table import Table
2323

src/pytorch_lightning/utilities/imports.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
_KINETO_AVAILABLE = torch.profiler.kineto_available()
3333
_OMEGACONF_AVAILABLE = package_available("omegaconf")
3434
_POPTORCH_AVAILABLE = package_available("poptorch")
35-
_RICH_AVAILABLE = package_available("rich") and compare_version("rich", operator.ge, "10.2.2")
3635
_TORCH_QUANTIZE_AVAILABLE = bool([eg for eg in torch.backends.quantized.supported_engines if eg != "none"])
3736
_TORCHVISION_AVAILABLE = RequirementCache("torchvision")
3837

0 commit comments

Comments
 (0)