diff --git a/README.md b/README.md index 2a2a9703..2d013f55 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,16 @@ pip install cellfinder-napari N.B. To speed up cellfinder, you need CUDA & cuDNN installed. Instructions [here](https://brainglobe.info/documentation/general/gpu.html). +#### Conda Install +`cellfinder-core` is available on `conda-forge`, however `tensorflow`, one of it's core dependencies, is not. +As a result; you _must_ manually install `tensorflow` into your environment - whether you do this before or after `conda install`ing doesn't matter. +Once you are ready, install `cellfinder-core` into the desired environment via conda; +```sh +conda install -c conda-forge cellfinder-core +``` + +Please bear in mind that running the `conda install` command above will exit without failing even if `tensorflow` is not present; however `tensorflow` will not be installed as part of this process, and thus `cellfinder-core` will not be usable. + ### Usage Before using cellfinder-core, it may be useful to take a look at the [paper](https://doi.org/10.1371/journal.pcbi.1009074) which diff --git a/src/cellfinder_core/__init__.py b/src/cellfinder_core/__init__.py index fa4fd04b..e0b2b8e7 100644 --- a/src/cellfinder_core/__init__.py +++ b/src/cellfinder_core/__init__.py @@ -5,6 +5,18 @@ except PackageNotFoundError as e: raise PackageNotFoundError("cellfinder-core package not installed") from e +# If tensorflow is not present, tools cannot be used. +# Throw an error in this case to prevent invocation of functions. +try: + TF_VERSION = version("tensorflow") +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 + __author__ = "Adam Tyson, Christian Niedworok, Charly Rousseau" __license__ = "BSD-3-Clause"