Executing a CellProfiler pipeline from Terminal (Mac OS X)


#1

Hi, I am wondering how to execute a fie of the form filename.cpproj from terminal. I tried ./filename.cpproj (after setting the permissions so that I was able to run the program), and that did not work. Is there a way to do this? Thanks!


Running a Pipeline Iteratively
#2

I figured out how to execute it actually, but how do I execute it and specify the inputs to the pipeline?


#3

Specifying a project file doesn’t work in the release version, but this bug has been fixed and will be included in the upcoming patch release. You can either wait for the release or you can download the current “bleeding-edge” version of the CellProfiler (with the fix) from our trunk build page (subject to the caveats therein).; 2.1.1 is our patch release candidate.

Also, you can run the pipeline headless but you need to save the file list with it; you can do this by selecting *File > Export > Pipeline… * and then in the dialog box that comes up, change the “Save as type” drop-down box to “Cellprofiler pipeline and file list”. This should work in the current release, BTW.
-Mark


#4

Also, to run the compiled version of CellProfiler on a Mac command-line try this:

(And of course, without ‘–help’ to actually run CP.)
Cheers,
David


FilterObjects by CalculateMath measurement works on macOS but fails on Linux
#5

Thank you. I’m running into a few issues executing commands that run CellProfiler from within Matlab. When I run the command of the form '“Applications/CellProfiler.app/Contents/MacOS/CellProfiler2.0” -r -i -o -p ‘’ from the command line, it runs my pipeline just fine, but when I run it from within Matlab using “system”, I get an import error with the reason being “Reason: Incompatible library version: _errors.so requires version 8.0.0 or later, but libhdf5.dylib provides version 7.0.0”. I’ve been trying to find a solution for a few days, and I haven’t been able to. I’m not sure if this is a common problem with a standard solution or not.


#6

I just came across this error message with a related library: blog.newsyland.com/mac-os-x/libt … magemagick. Might the solution there help?
-Mark


#7

This solution is still giving me the same results. In this example, the library not loaded is shown as “Library not loaded: /opt/local/lib/libtiff.3.dylib”, whereas my library not being loaded is “@executable_path/…/Frameworks/libhdf5_hl.dylib”. I’m wondering if the fact that there is @executable_path in my library path means that something is fundamentally different. Also, I’ve tried replacing the “@executable_path” portion with both “@loader_path” and “@rpath”, but neither of those worked either. Should I be including the “@executable_path” in each command? Thank you.


#8

Did you try the ‘setenv’ method withe the DYLD_LIBRARY_PATH at the end of the post Mark linked to?
It seems like a Matlab issue to me, in any case. A more robust method might be to invoke a virtual environment to ‘wall off’ CP, but that would require installing the developer’s version of CP, as described in our developer’s wiki here: github.com/CellProfiler/CellPro … on-for-Mac

Good luck!
David


#9

Hi it seems like the command is lost. I am also looking for this answer, can you help me? When I run it it says, NO module named ‘cellprofiler’ which is the main one, seems strange since I can run it with the normal app icon


#10

Hi,

Can you post the exact full error message you’re getting (and what command you’re running that’s causing it)?

Also, just in case you didn’t know, running from the command line will cause CP to only run one core at a time (rather than multicore), so we don’t recommend it for large image sets unless you have some sort of job-dispatching system set up.


#11

Thank you for your reply. The error is
python CellProfiler.py
ImportError: No module named cellprofiler

In the folder containing CellProfiler.py and the contents of CellPrfiler.app there is no folder containing the source to correctly import the package to start CP by comand line.

I have made it work on Linux but I don’t know Mac very well. I can run it in Mac using GUI and clicking on the app icon. I did not install it, it was installed before I arrived so I don’t know the intricacies of installing it on Mac and I don’t know if it would be as easy as cloning the git repository and copying CellProfiler.py and executing it.

I was also wondering if it is possible to import cell profiler as a module in a python script. I know it is here: https://github.com/CellProfiler/CellProfiler/wiki/CellProfiler-as-a-Python-package
but I am wondering how does the cppipe has to be configured, does it have to be like
this ?

I havent found (if any) a small tutorial (recent: 2017-2018) that explains how a pipeline should be configured using the GUI in order to ensure that the command line receives an input folder (or list of images) and an output location.

I realize this is a long question I will try to formulate it better and start a new thread. But I would very much appreciate some light here. Later on I could even help creating a wiki for it :wink:

Thank you!


#12

You could either clone the CellProfiler repository and install with pip (i.e. pip install --editable . from the CellProfiler directory) or you could symlink the packaged executable to somewhere on your path, e.g.

ln -s /Applications/CellProfiler-3.0.0.app/Contents/MacOS/cp /usr/local/bin/cellprofiler

and use the cellprofiler command.

If you want to use CellProfiler inside another package I strongly recommend cloning the CellProfiler repository. pip will make sure it’s on your Python path and usable from wherever.


#13

It’s also possible to install CellProfiler in an Anaconda environment as described here: https://github.com/CellProfiler/CellProfiler/wiki/Conda-Installation