diff --git a/.github/actions/install-parcels/action.yml b/.github/actions/install-parcels/action.yml index a7aea0602..66a3bbccc 100644 --- a/.github/actions/install-parcels/action.yml +++ b/.github/actions/install-parcels/action.yml @@ -24,8 +24,6 @@ runs: environment-file: ${{ inputs.environment-file }} python-version: ${{ inputs.python-version }} channels: conda-forge - cache-environment: true - cache-downloads: true - name: MPI support if: ${{ ! (runner.os == 'Windows') }} run: conda install -c conda-forge mpich mpi4py diff --git a/parcels/_compat.py b/parcels/_compat.py index 981ef30a5..6efab15a7 100644 --- a/parcels/_compat.py +++ b/parcels/_compat.py @@ -2,13 +2,18 @@ __all__ = ["MPI", "KMeans"] +from typing import Any + +MPI: Any | None = None +KMeans: Any | None = None + try: - from mpi4py import MPI + from mpi4py import MPI # type: ignore[no-redef] except ModuleNotFoundError: - MPI = None + pass # KMeans is used in MPI. sklearn not installed by default try: - from sklearn.cluster import KMeans + from sklearn.cluster import KMeans # type: ignore[no-redef] except ModuleNotFoundError: - KMeans = None + pass