Cellprofiler 3.1.9 on Ubuntu 18.04 LTS

So I am trying to install Cellprofiler 3.1.9 on Ubuntu 18.04 (as the title might have hinted) so I can use the generated Pipelines directly in Galaxy. I also installed cellprofiler 4.0 on a venv which works great, but I cant get 3.1.9 installed… I currently use the tutorial stated here Cellprofiler install

sadly after the sudo pip install . command I get the error:

Collecting pillow>=7.1.0 (from centrosome->CellProfiler==3.1.9)
Could not find a version that satisfies the requirement pillow>=7.1.0 (from centrosome->CellProfiler==3.1.9) (from versions: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 2.0.0, 2.1.0, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.3.2, 2.4.0, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0, 2.6.1, 2.6.2, 2.7.0, 2.8.0, 2.8.1, 2.8.2, 2.9.0, 3.0.0, 3.1.0rc1, 3.1.0, 3.1.1, 3.1.2, 3.2.0, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.4.0, 3.4.1, 3.4.2, 4.0.0, 4.1.0, 4.1.1, 4.2.0, 4.2.1, 4.3.0, 5.0.0, 5.1.0, 5.2.0, 5.3.0, 5.4.0, 5.4.1, 6.0.0, 6.1.0, 6.2.0, 6.2.1, 6.2.2)
No matching distribution found for pillow>=7.1.0 (from centrosome->CellProfiler==3.1.9)

does anybody know what is going wrong ?

For some reason, it looks like that’s trying to install an unpinned version of centrosome rather than the pinned version that’s in the 3.1.9 CellProfiler setup.py; that pinned to centrosome 1.1.6, which just requires pillow but without a version argument; the current version of centrosome DOES though.

Can you try running sudo pip install centrosome==1.1.6, and then if that completes, trying the sudo pip install . command again?

In general, though, since Python 2.7 has been EOLed, probably good to move to CP4 whenever feasible!

1 Like

I indeed also use CP4 but I want to use cellprofiler 3.1.9 to generate pipelines that I can directly use in galaxy, this is why I am trying to install this. This tip got me a bit further, it says that cellprofiler was correctly installed:

Successfully installed CellProfiler-3.1.9 boto3-1.17.88 botocore-1.20.88 configparser-4.0.2 contextlib2-0.6.0.post1 dask-1.2.2 docutils-0.17.1 future-0.18.2 futures-3.3.0 importlib-metadata-2.1.1 inflect-3.0.2 javabridge-1.0.19 jmespath-0.10.0 joblib-0.14.1 mahotas-1.4.11 mysqlclient-1.4.6 numpy-1.15.4 pathlib2-2.3.5 prokaryote-2.4.1 python-bioformats-1.5.2 pyzmq-15.3.0 raven-6.10.0 s3transfer-0.4.2 scandir-1.10.0 scikit-image-0.14.0 scikit-learn-0.20.4 scipy-1.1.0 toolz-0.10.0 urllib3-1.26.5 zipp-1.2.0

But then when I try to runn the cellprofiler command I get an new error …

Bad key "legend.title_fontsize" on line 22 in
/home/mark/.config/matplotlib/stylelib/notebook.mplstyle.
You probably need to get an updated matplotlibrc file from
http://github.com/matplotlib/matplotlib/blob/63261cc23e145c445a9907d84a9db2b1ecd878eb/matplotlibrc.template
or from the matplotlib source distribution
/usr/lib/python2.7/dist-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.26.5) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)
Traceback (most recent call last):
  File "/usr/local/bin/cellprofiler", line 11, in <module>
    load_entry_point('CellProfiler==3.1.9', 'console_scripts', 'cellprofiler')()
  File "/usr/local/lib/python2.7/dist-packages/cellprofiler/__main__.py", line 162, in main
    app = cellprofiler.gui.app.App(0, workspace_path=workspace_path, pipeline_path=pipeline_path)
  File "/usr/local/lib/python2.7/dist-packages/cellprofiler/gui/app.py", line 55, in __init__
    super(App, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk3/wx/_core.py", line 8628, in __init__
    self._BootstrapApp()
  File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk3/wx/_core.py", line 8196, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/cellprofiler/gui/app.py", line 58, in OnInit
    import cellprofiler.gui.cpframe
  File "/usr/local/lib/python2.7/dist-packages/cellprofiler/gui/cpframe.py", line 11, in <module>
    import cellprofiler.gui.help.menu
  File "/usr/local/lib/python2.7/dist-packages/cellprofiler/gui/help/menu.py", line 5, in <module>
    import requests
  File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 97, in <module>
    from . import utils
  File "/usr/lib/python2.7/dist-packages/requests/utils.py", line 24, in <module>
    from . import certs
ImportError: cannot import name certs

Any chance there is a way to fix this?

As the error message suggests, did you try updating matplotlib? Something like

pip install --upgrade matplotlib

I would suggest to install using conda to avoid issues with multiple versions of python and packages:

conda install -c bioconda cellprofiler

You may need to also enable the conda-forge channel for some dependencies. See here: Getting Started — Bioconda documentation

A search of stack overflow also suggests that pip uninstalling and then pip reinstalling requests may help out; beyond that, sorry, no, have not seen that particular issue before.

Wouldn’t this result in the installation of version 4.0 instead of 3.1.9?

I tried this indeed but this sadly did not work :frowning:

Darn, that’s too bad, was hoping it would be simple.

You may want to compare your pip freeze to this list to see if there are any obvious differences- particularly things that are different in X or Y of the package-X.Y.Z .

No because as far as I know CP4.0 isn’t in bioconda yet but if you’re worried, you can specify a version number, e.g.

conda install  cellprofiler=3.9.1
$ conda install -c bioconda cellprofiler=3.1.9

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: - 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                               

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: - 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                               

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

I get the same error if I try: $ conda install -c bioconda cellprofiler=3.1.9 or $ conda install -c bioconda cellprofiler

It seems when I look at my pip freeze, my list is way shorter, maybe this creates problems?

python -m pip freeze
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
anaconda-clean==1.0
asn1crypto==0.22.0
certifi==2020.6.20
cffi==1.10.0
chardet==3.0.4
conda==4.8.4
conda-package-handling==1.6.0
cryptography==1.8.1
enum34==1.1.6
futures==3.3.0
idna==2.6
ipaddress==1.0.18
packaging==16.8
Pillow==6.2.2
pycosat==0.6.3
pycparser==2.18
pyOpenSSL==17.0.0
pyparsing==2.2.0
PySocks==1.7.1
PyYAML==3.12
requests==2.25.1
ruamel.ordereddict==0.4.15
ruamel.yaml==0.11.14
scandir==1.10.0
six==1.10.0
tqdm==4.59.0
urllib3==1.25.7

Did you truncate the error message? The list of packages with conflicts should appear at the bottom and here it looks empty.
Which conda channels have you enabled? It’s recommend to only use default, bioconda and conda-forge in this order.
Also another possibility is to use the corresponding docker container:

docker pull quay.io/biocontainers/cellprofiler:3.1.9

Sorry what do you mean with your first two points? I tried the docker pull and I think this worked but what should I do after the pull?

sudo docker pull quay.io/biocontainers/cellprofiler:3.1.9
3.1.9: Pulling from biocontainers/cellprofiler
264b774875af: Pull complete 
717b890011ce: Pull complete 
f3b45efb86ce: Pull complete 
Digest: sha256:298e544c0f00cb9e4188316ab8d42fc60c7489ef5fe0f7e2f6c5a1c13e4a1f49
Status: Downloaded newer image for quay.io/biocontainers/cellprofiler:3.1.9
quay.io/biocontainers/cellprofiler:3.1.9

What I meant is that below

Output in format: Requested package → Available versions

I expected to see a list of packages that have version conflicts.
To learn more about channels, see the documentation here: Conda channels — conda 4.10.1.post25+ca6094cc1 documentation

Actually the container is probably not what you want since it’s meant to run without the GUI.

Ah I see, no I did not truncate the message! this was all it said… and for the channels, I only have the default channels:

conda info

     active environment : None
       user config file : /home/mark/.condarc
 populated config files : 
          conda version : 4.8.4
    conda-build version : not installed
         python version : 2.7.13.final.0
       virtual packages : __glibc=2.27
       base environment : /home/mark/miniconda  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/mark/miniconda/pkgs
                          /home/mark/.conda/pkgs
       envs directories : /home/mark/miniconda/envs
                          /home/mark/.conda/envs
               platform : linux-64
             user-agent : conda/4.8.4 requests/2.25.1 CPython/2.7.13 Linux/5.4.0-74-generic ubuntu/18.04.5 glibc/2.27
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

Add channels to your .condarc with (in this order):

conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge

then you need to do:

conda create -n cellprofiler cellprofiler python=2.7
conda install -c biohpc wxPython

The last line installs wxPython-3.0.2.0 because there seems to be issues with the versions in conda-forge.

I am getting closer! The installation worked and I can activate the enviroment but once I run $ cellprofiler

I get the error

Traceback (most recent call last):
  File "/home/mark/miniconda/envs/cellprofiler/bin/cellprofiler", line 10, in <module>
    sys.exit(main())
  File "/home/mark/miniconda/envs/cellprofiler/lib/python2.7/site-packages/cellprofiler/__main__.py", line 146, in main
    import cellprofiler.gui.app
  File "/home/mark/miniconda/envs/cellprofiler/lib/python2.7/site-packages/cellprofiler/gui/app.py", line 12, in <module>
    import wx
  File "/home/mark/miniconda/envs/cellprofiler/lib/python2.7/site-packages/wx-3.0-gtk2/wx/__init__.py", line 45, in <module>
    from wx._core import *
  File "/home/mark/miniconda/envs/cellprofiler/lib/python2.7/site-packages/wx-3.0-gtk2/wx/_core.py", line 4, in <module>
    import _core_
ImportError: liblzma.so.0: cannot open shared object file: No such file or directory
(cellprofi

You probably need to install liblzma-dev:

sudo apt install liblzma-dev

If it’s already there, you may need to create a symlink to it with something like

sudo ln -s liblzma.so liblzma.so.0

Do you have any chance where I need to create this? Because I generated the new Liblzma.so.0 file in my home directiory but I get the same error, Maybe because cellprofiler doesn’t search in the right directory?