|
1 | 1 | # RunCellpose |
2 | 2 |
|
3 | | -RunCellpose is one of the modules that has additional dependencies that are not packaged with the built CellProfiler. |
4 | | -Therefore, you must additionally download RunCellpose's dependencies. |
5 | | -See [Using Plugins](using_plugins.md) for more information. |
| 3 | +You can run RunCellpose using Cellpose in a Docker that the module will automatically download for you so you do not have to perform any installation yourself. |
| 4 | +See [Using plugins - Using Docker](using_plugins.md/#using-docker-to-bypass-installation-requirements) for more information on using Docker with CellProfiler. |
| 5 | + |
| 6 | +You can also this module using Cellpose installed to the same Python environment as CellProfiler. |
| 7 | +See [Using plugins - Installing dependencies](using_plugins.md/#installing-plugins-with-dependencies-using-cellprofiler-from-source) for more information on installing dependencies for CellProfiler plugins. |
| 8 | + |
| 9 | +## Troubleshooting |
| 10 | + |
| 11 | +If you are running RunCellpose in a docker and you get an error like this: |
| 12 | +`No such file or directory: '/Users/eweisbar/Documents/CPoutput/.cellprofiler_temp/c564a507-17e5-4256-837d-6e1d59892524/img/c564a507-17e5-4256-837d-6e1d59892524_seg.npy` |
| 13 | +It is likely an issue with running out of memory in the Docker. |
| 14 | +See [this Github issue](https://github.com/CellProfiler/CellProfiler-plugins/issues/243) for more information. |
| 15 | + |
| 16 | +If you open a saved pipeline that contains the RunCellpose module and your saved settings are not parsed properly, we recommend you add a new RunCellpose module to your pipeline and copy the settings from the old module to the new module. |
| 17 | + |
| 18 | +If you get an error message indicating the Docker selected in your pipeline is not available, this is likely because we updated the Docker image names to more explicitly indicate which version of Cellpose they are using. |
| 19 | +Please select one of the updated Docker image names in your pipeline. |
| 20 | + |
| 21 | +## Installing Cellpose in the same Python environment as CellProfiler |
| 22 | + |
| 23 | +We provide some information below about installations that have worked for us. |
| 24 | +If you are having challenges with installing Cellpose in your CellProfiler environment, please reach out on the [forum](https://forum.image.sc/). |
| 25 | + |
| 26 | +### Omnipose (Cellpose 1) |
| 27 | + |
| 28 | +In an environment that has Cellprofiler installed, run the following commands to install Omnipose and Cellpose 1: |
| 29 | + |
| 30 | +```bash |
| 31 | +pip install omnipose |
| 32 | +pip install cellpose==1.0.2 |
| 33 | +``` |
| 34 | + |
| 35 | +### Cellpose 2 |
| 36 | + |
| 37 | +In an environment that has Cellprofiler installed, run the following commands to install Cellpose 2: |
| 38 | + |
| 39 | +```bash |
| 40 | +pip install cellpose==2.3.2 |
| 41 | +``` |
| 42 | + |
| 43 | +If you have an older version of Cellpose, run the following command to reinstall Cellpose 2: |
| 44 | + |
| 45 | +```bash |
| 46 | +python -m pip install --force-reinstall -v cellpose==2.3.2 |
| 47 | +``` |
| 48 | + |
| 49 | +### Cellpose 3 |
| 50 | + |
| 51 | +On Mac M1/M2, to create a new environment with CellProfiler and Cellpose 4, run the following commands: |
| 52 | + |
| 53 | +```bash |
| 54 | +export LDFLAGS= "-L/opt/homebrew/opt/[email protected]/lib" |
| 55 | +export CPPFLAGS= "-I/opt/homebrew/opt/[email protected]/include" |
| 56 | +export PKG_CONFIG_PATH= "/opt/homebrew/opt/[email protected]/lib/pkgconfig" |
| 57 | +conda create -y --force -n cellpose3_cellprofiler python=3.9 h5py=3.6.0 python.app scikit-learn==0.24.2 scikit-image==0.18.3 openjdk --platform osx-arm64 |
| 58 | +conda activate cellpose3_cellprofiler |
| 59 | +pip install cellpose==3.1.1.2 |
| 60 | +pip install mysqlclient==1.4.6 cellprofiler |
| 61 | +``` |
| 62 | + |
| 63 | +### Cellpose-SAM (Cellpose 4) |
| 64 | + |
| 65 | +On Mac M1/M2, to create a new environment with CellProfiler and Cellpose 4, run the following commands: |
| 66 | + |
| 67 | +```bash |
| 68 | +export LDFLAGS= "-L/opt/homebrew/opt/[email protected]/lib" |
| 69 | +export CPPFLAGS= "-I/opt/homebrew/opt/[email protected]/include" |
| 70 | +export PKG_CONFIG_PATH= "/opt/homebrew/opt/[email protected]/lib/pkgconfig" |
| 71 | +conda create -y --force -n cellposeSAM_cellprofiler python=3.9 h5py=3.6.0 python.app scikit-learn==0.24.2 scikit-image==0.18.3 openjdk --platform osx-arm64 |
| 72 | +conda activate cellposeSAM_cellprofiler |
| 73 | +pip install cellpose==4.0.6 |
| 74 | +pip install mysqlclient==1.4.6 cellprofiler |
| 75 | +``` |
6 | 76 |
|
7 | 77 | ## Using RunCellpose with a GPU |
8 | 78 |
|
9 | | -If you want to use a GPU to run the model (this is recommended for speed), you'll need a compatible version of PyTorch and a supported GPU. |
| 79 | +If you want to use a GPU to run the model (this is recommended for speed), you'll need a compatible version of PyTorch and a supported GPU. |
10 | 80 | General instructions are available at this [link](https://pytorch.org/get-started/locally/). |
11 | 81 |
|
12 | | -1. Your GPU should be visible in Device Manager under Display Adaptors. |
| 82 | +1. Your GPU should be visible in Device Manager under Display Adaptors. |
13 | 83 | If your GPU isn't there, you likely need to install drivers. |
14 | 84 | [Here](https://www.nvidia.com/Download/Find.aspx) is where you can find NVIDIA GPU drivers if you need to install them. |
15 | 85 |
|
16 | | - |
17 | 86 | 2. To test whether the GPU is configured correctly: |
18 | | - * Run `python` on the command line (i.e., in Command Prompt or Terminal) to start an interactive session |
19 | | - * Then run the following |
20 | | - ``` |
| 87 | + |
| 88 | +* Run `python` on the command line (i.e., in Command Prompt or Terminal) to start an interactive session |
| 89 | +* Then run the following |
| 90 | + |
| 91 | + ```bash |
21 | 92 | import torch |
22 | 93 | torch.cuda.is_available() |
23 | 94 | ``` |
24 | | - * If this returns `True`, you're all set |
25 | | - * If this returns `False`, you likely need to install/reinstall torch. See [here](https://pytorch.org/get-started/locally/) for your exact command. |
26 | | - * Exit the session with `exit()` then install torch if necessary |
27 | | - ``` |
| 95 | + |
| 96 | +* If this returns `True`, you're all set |
| 97 | +* If this returns `False`, you likely need to install/reinstall torch. See [here](https://pytorch.org/get-started/locally/) for your exact command. |
| 98 | +* Exit the session with `exit()` then install torch if necessary |
| 99 | + |
| 100 | + ```bash |
28 | 101 | pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113 |
29 | 102 | ``` |
30 | | - If you have a previous version of torch installed, make sure to run `pip uninstall torch` first. |
31 | 103 |
|
| 104 | + If you have a previous version of torch installed, make sure to run `pip uninstall torch` first. |
32 | 105 |
|
33 | 106 | **NOTE**: You might get a warning like this: |
34 | | -``` |
| 107 | + |
| 108 | +```bash |
35 | 109 | W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found |
36 | 110 | 2022-05-26 20:24:21.906286: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. |
37 | 111 | ``` |
38 | | -If you don't have a GPU, this is not a problem. If you do, your configuration is incorrect and you need to try reinstalling drivers and the correct version of CUDA for your system. |
| 112 | +
|
| 113 | +If you don't have a GPU, this is not a problem. |
| 114 | +If you do, your configuration is incorrect and you need to try reinstalling drivers and the correct version of CUDA for your system. |
0 commit comments