diff --git a/CHANGELOG.md b/CHANGELOG.md index b283db5d..08f4f904 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +--- + +## [UnReleased] - 2025-MM-DD + +### Fixed + +- Fixed `compare_version` if runtime error ([#427](https://github.com/Lightning-AI/utilities/pull/427)) + + --- ## [0.15.2] - 2025-08-06 diff --git a/src/lightning_utilities/core/imports.py b/src/lightning_utilities/core/imports.py index a433cea3..0012fae2 100644 --- a/src/lightning_utilities/core/imports.py +++ b/src/lightning_utilities/core/imports.py @@ -76,7 +76,7 @@ def compare_version(package: str, op: Callable, version: str, use_base_version: """ try: pkg = importlib.import_module(package) - except ImportError: + except (ImportError, RuntimeError): return False try: # Use importlib.metadata to infer version