diff --git a/src/lightning/fabric/CHANGELOG.md b/src/lightning/fabric/CHANGELOG.md index bec5b212b3ec9..b8c1af644ad4a 100644 --- a/src/lightning/fabric/CHANGELOG.md +++ b/src/lightning/fabric/CHANGELOG.md @@ -25,13 +25,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Fixed -- Fixed `EADDRINUSE` errors in distributed tests with port manager and retry logic ([#21309](https://github.com/Lightning-AI/pytorch-lightning/pull/21309)) - +- Fixed issue in detecting MPIEnvironment with partial mpi4py installation ([#21353](https://github.com/Lightning-AI/pytorch-lightning/pull/21353)) - Learning rate scheduler is stepped at the end of epoch when `on_train_batch_start` returns -1 ([#21296](https://github.com/Lightning-AI/pytorch-lightning/issues/21296)). - --- ## [2.5.5] - 2025-09-05 diff --git a/src/lightning/fabric/plugins/environments/mpi.py b/src/lightning/fabric/plugins/environments/mpi.py index dd4897663d187..cb7473d52c6e7 100644 --- a/src/lightning/fabric/plugins/environments/mpi.py +++ b/src/lightning/fabric/plugins/environments/mpi.py @@ -73,7 +73,11 @@ def detect() -> bool: if not _MPI4PY_AVAILABLE: return False - from mpi4py import MPI + try: + # mpi4py may be installed without MPI being present + from mpi4py import MPI + except ImportError: + return False return MPI.COMM_WORLD.Get_size() > 1