diff --git a/.github/workflows/test_include_guard.yaml b/.github/workflows/test_include_guard.yaml index 26277d98..5a1c4a33 100644 --- a/.github/workflows/test_include_guard.yaml +++ b/.github/workflows/test_include_guard.yaml @@ -35,8 +35,8 @@ jobs: import cellfinder.core import cellfinder.napari - - name: Uninstall tensorflow - run: python -m pip uninstall -y tensorflow + - name: Uninstall keras + run: python -m pip uninstall -y keras - name: Test (broken) import id: broken_import diff --git a/cellfinder/__init__.py b/cellfinder/__init__.py index 9971f648..f351cee7 100644 --- a/cellfinder/__init__.py +++ b/cellfinder/__init__.py @@ -5,20 +5,17 @@ except PackageNotFoundError as e: raise PackageNotFoundError("cellfinder package not installed") from e -# If tensorflow is not present, tools cannot be used. +# If Keras is not present with a backend, tools cannot be used. # Throw an error in this case to prevent invocation of functions. try: - TF_VERSION = version("tensorflow") + KERAS_VERSION = version("keras") except PackageNotFoundError as e: - try: - TF_VERSION = version("tensorflow-macos") - except PackageNotFoundError as e: - raise PackageNotFoundError( - f"cellfinder tools cannot be invoked without tensorflow. " - f"Please install tensorflow into your environment to use cellfinder tools. " - f"For more information, please see " - f"https://github.com/brainglobe/brainglobe-meta#readme." - ) from e + raise PackageNotFoundError( + f"cellfinder tools cannot be invoked without Keras. " + f"Please install tensorflow into your environment to use cellfinder tools. " + f"For more information, please see " + f"https://github.com/brainglobe/brainglobe-meta#readme." + ) from e __author__ = "Adam Tyson, Christian Niedworok, Charly Rousseau" __license__ = "BSD-3-Clause" diff --git a/pyproject.toml b/pyproject.toml index 96006dfe..5c73d68c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,9 +29,8 @@ dependencies = [ "numpy", "scikit-image", "scikit-learn", - # See https://github.com/brainglobe/cellfinder-core/issues/103 for < 2.12.0 pin - "tensorflow-macos>=2.5.0,<2.12.0; platform_system=='Darwin' and platform_machine=='arm64'", - "tensorflow>=2.5.0,<2.12.0; platform_system!='Darwin' or platform_machine!='arm64'", + "keras", + "tf-nightly==2.16.0.dev20240101", # pinning to same TF as Keras 3.0 "tifffile", "tqdm", ] @@ -124,7 +123,6 @@ commands = python -m pytest -v --color=yes deps = pytest pytest-cov - pytest-lazy-fixture pytest-mock pytest-timeout # Even though napari is a requirement for cellfinder.napari, we have to