CellProfiler-plugins
CellProfiler-plugins copied to clipboard
Installation and Functionality Problems with Cellpose Plugin
Installation and Functionality Problems with Cellpose Plugin:
My goal is to compare Cellpose stand-alone to the Cellpose plugin inside CellProfiler
But, I have run into many issues, ranging from installing using source to the module not working. I will be discussing the issues I had while on my Linux computer - Hopefully this documentation can help guide others who may have similar challenges. I did have issues similar to the ones I discussed that I asked about on the forum (see https://forum.image.sc/t/macos-source-install-of-cellprofiler-importerror/71058).
Installation Issues from Source
I had to try and install CellProfiler from cloning so that I could follow the instructions from the forum post for using the Cellpose plugin. I cross-referenced these steps as shown in the "Linux (e.g Ubuntu) Only" section of the Conda Installation part of the Wiki, since the .yaml file would install CellProfiler from the Github to allow for me to add the plugin.
After creating the Conda environment with the provided .yaml file, I ran into pip installation errors where the Python version was 2.0 but CellProfiler needs to run Python >= 3.8. Based on this, that means that the dependencies that are being installed with this file are out of date for CellProfiler v4.2.4. Even after I tried updating some of the dependencies to download the up-to-date versions, it created an error where the files were conflicting with each other and it had to find the issue (which was taking over 10 minutes to run).
Since this file failed to work, I decided to use the "CellProfiler 4" .yaml file structure from the same page, but changed the pip dependencies install from - cellprofiler==4.2.4
to - git+https://github.com/CellProfiler/CellProfiler.git@master
.
Note: Because the link is set to @master
, the version of CellProfiler that will be ran (when I did get it work as described below) is v5.0.0beta1.
When CellProfiler didn't work, I then uninstalled and tried installing after cloning the repo by running:
cd CellProfiler pip install -e .
Anytime I would try to start CellProfiler after installing, I got one of two different errors:
-
cellprofiler: not a command
OR -
ImportError: cannot import name 'set_force_bioformats' from 'cellprofiler_core.preferences'
I could not pinpoint a pattern of when one would happen over another.
When I got the cellprofiler: not a command
, I would use python3 cellprofiler
and then CellProfiler would open, which is weird because the command cellprofiler
should work.
Note: I have no errors when I pip install cellprofiler==4.2.4
and I can open the program using the cellprofiler
command. But I can not add the plugin into the appropriate folder since it wasn’t installed from the Github repo.
Even after changing to the v4.2.4 tag in the repo and having CellProfiler-core cloned and installed, I still had issues and it look many tries of uninstalling and installing for it to finally work (and using the python3 cellprofiler
command).
RunCellpose Issues
When I finally had CellProfiler version 4.2.4 running from the cloned repo, I tried following the instructions to add the runcellpose.py
file into the cellprofiler directory, specifically a Plugins
folder in my CellProfiler preferences.
I could not find a preferences folder and there were two plugins
folders, located in the 'CellProfilerfolder and in the
modulesfolder. No matter if I put the file into either of those folders, the
RunCellpose` module would not show up when I opened CellProfiler.
The way that worked for me was adding the file into the modules folder and adding the module into the __init__.py
files (e.g adding "runcellpose": "RunCellpose",
).
Once RunCellpose was available to use in the CellProfiler GUI, I tried testing it with my images. I did make sure that I already installed Cellpose (pip install cellpose
) before attempting to use the module.
When I fixed the parameters, I decided before starting test mode to test the Test GPU
button. I then got this error on my terminal:
AttributeError: module 'cellpose.models' has no attribute 'use_gpu'
When I tried running the module in test mode, there were two errors produced in terminal:
- ModuleNotFoundError: No module named 'cellpose'
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf3 in position 0: invalid continuation byte
Then CellProfiler would crash.
These are the issues that I came across when trying to use the Cellpose plugin. I do really want to use this plugin to test how it works in comparison to Cellpose 2.0 GUI so I do hope that these observations help.
Desktop:
- OS: Pop!_OS 20.04 LTS
- CellProfiler Version 4.2.4
- Downloaded from source
- Cloned from Github repo
Hi,
I'm sorry you've been having so many issues!
- You definitely should be using the CellProfiler 4 conda file to install any version of CellProfiler 4 via conda, and I would definitely recommend for a beginner staying with just a numbered version (ie 4.2.4) rather than trying to get the absolute latest version from the repo (
git clone CellProfiler
). In a python 3.8 or 3.9 environment, if you don't want to use conda,pip install cellprofiler
should just work. - You can't put plugins inside the CellProfiler folder ,if you HAVE git cloned CellProfiler - you can put them anywhere else on our machine (and then you can configure the location in the preferences menu - once you close and reopen CellProfiler, it should then find them). What you've done is add it to the actual list of CellProfiler modules that it thinks are part of the main program, which should be fine, but just letting you know that there is an easier way.
- It's hard to know exactly why you're then getting the errors you're seeing without more information -
- For the first one, can you run
pip freeze
inside the environment you're trying to run CellProfiler in, just to confirm installation and to see if there seem to be any obvious issues there? - For the second one, it would be really helpful to have the whole stack trace - it's not really possible to figure out why it happened just from one line, sorry.
- For the first one, can you run
I'm also going to move this over to the plugins repo, since it seems to be a plugins issue. We'll try to get it sorted for you!
@bethac07
You are a miracle worker! Once I did this step (e.g. configure the location in the preferences menu, the module finally appeared in CellProfiler.
I started testing it in the test mode
, and the only issue I had was that my computer would create a popup that said "CellProfiler is not responding" but I can see in the terminal it is running. When I run analyze images
, the popup does not come up.
I think the main issue here was that my CellProfiler plugins setting did not have the correct path to where the plugin was located. I fixed this by going into File -> Preferences
and setting the path for the CellProfiler plugins
to the CellProfiler repo (specifically in the cellprofiler/modules directory within the folder. In that modules folder, I already had the runcellpose.py file in there and within the init.py file.
I do have one question regarding this plugin. In the CellProfiler Cellpose plugin, there are two detection modes (not including custom), which are Nuclei and Cells. In the traditional Cellpose, the models you can select from are nuclei or cyto.
Since here is no model named cyto
, can I assume that the model in the CellProfiler Cellpose plugin called Cells is the same model?
If the Cells mode is not synonymous with the cyto model, how would I be able to import that model?
Thank you in advance for your amazing help!
I do have one question regarding this plugin. In the CellProfiler Cellpose plugin, there are two detection modes (not including custom), which are Nuclei and Cells. In the traditional Cellpose, the models you can select from are nuclei or cyto.
Since here is no model named cyto, can I assume that the model in the CellProfiler Cellpose plugin called Cells is the same model?
If the Cells mode is not synonymous with the cyto model, how would I be able to import that model?
@fefossa When you work on CellPose issues, can you answer this and update the help info in the plugin to clarify this?
Hi @jenna-tomkinson
I do have one question regarding this plugin. In the CellProfiler Cellpose plugin, there are two detection modes (not including custom), which are Nuclei and Cells. In the traditional Cellpose, the models you can select from are nuclei or cyto.
Since here is no model named
cyto
, can I assume that the model in the CellProfiler Cellpose plugin called Cells is the same model?If the Cells mode is not synonymous with the cyto model, how would I be able to import that model?
-
On December/22 the runcellpose plugin was updated to allow the use of cellpose 2.x models, so now the names of the models match the same as you'd see on cellpose ('nuclei', 'cyto, 'cyto2', and others).
-
Now we have updated instructions for installation of plugins with dependencies using a setup.py file that should take care of the cellpose requirements. We hope that eases installation.
If you get into any new issues please let us know!