Skip to content

CellProfiler Analyst Developer's version installation for Mac

Nodar Gogoberidze edited this page Jan 26, 2024 · 30 revisions

Instuctions for CPA3

Install mysql on system using homebrew

Install homebrew

brew install pkg-config

brew install mysql

Install Java - OpenJDK

Find out what version of java is currently being shipped by homebrew

$ brew update
$ brew info java

You can get the latest version if prokaryote supports it with

$ brew install java

Otherwise, Java11 is the most up-to-date Java LTS (LongTermSupport) release and can be installed with

$ brew install java11

(For installing other versions of Java with homebrew see AdoptOpenJDK )

If homebrew tells you to softlink and/or add Java to your path at the end of installation, be sure to do so. Otherwise, any versions you install will not be visible in the next step.

Get the exact name of your available Java versions

$ ls /Library/Java/JavaVirtualMachines/

Set your JAVA_HOME environment variable by adding it to your .zshrc or .bashrc (depending on the Shell used).

  • For example, if your Java installation is located at /Library/Java/JavaVirtualMachines/openjdk-14.0.2.jdk/Contents/Home then add the following to your .zshrc: export JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk-14.0.2.jdk/Contents/Home"
  • Don't forget to source your .zshrc file
$ source ~/.zshrc

Optionally setup a conda environment

conda create --name cpa python=3.8

conda activate cpa

If/when using conda, you will need a "framework build" of python. The python.app package is such a build. Once installed, to use it, type pythonw wherever you would normally type python.

conda install python.app

Install Python 3.8

If you would rather not use conda, you should make sure that you are using python 3.8.

You can install with homebrew:

brew install [email protected]

To use it, you will need type python3.8 <command> in the terminal. To use the specific version of pip associated with this python version, you will need to type pip3.8 <command> in your terminal.

Download CellProfiler-Analyst and install it

Run git clone from whatever directory you want the CellProfiler-Analyst source code to live.

git clone https://github.com/CellProfiler/CellProfiler-Analyst.git

cd CellProfiler-Analyst

python -m pip install "numpy~=1.24.4"

python -m pip install -e .

Run CellProfiler-Analyst

python -m CellProfiler-Analyst

If you used conda, remember to use python.app, the framework build:

pythonw -m CellProfiler-Analyst

Instructions for CPA2

Note: We also offer a [vagrant solution] (https://github.com/CellProfiler/metabolism).

CPA developer's version used to require CP to be installed, but it should be independent with the javabridge, etc. now factored out (afaik). Nevertheless, these notes are using my Mac (10.9) which already had CP developer's version working (May 2014).

pip install javabridge

pip install python-bioformats

pip install verlib

pip install mock (not sure if this is strictly necessary, but it was also listed in requirements.txt here so I pip-installed it)

Run CPA with (still from within virtualenv)

python ./<YOUR CPA GITHUB DIR>/CellProfiler-Analyst.py

Java issues

To see what Java versions are installed on your system, use the command below; as of CPA 2.2.1 Java8 (or OpenJDK8) is required.

/usr/libexec/java_home -V

Matching Java Virtual Machines (3):
    11.0.2, x86_64:	"OpenJDK 11.0.2"	/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
    1.8.0_192, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
    1.8.0_51, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home

To set JAVA_HOME on your system to a Java8/JDK8 installation, get the version from the Java8 install on your machine (ie on mine, I will use 1.8.0_192) - note that the second step is copying the line into a file, at which point you can save and close it (with Ctl+O then Ctl+X)

$ nano ~/.bash_profile 

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8.0_192)

$ source ~/.bash_profile

$ echo $JAVA_HOME

Tweaks

After installation, you might want to check the page [https://github.com/CellProfiler/CellProfiler-Analyst/wiki/CellProfiler-Analyst-Developer-Tweaks](CellProfiler Analyst Developer Tweaks) for relevant optimizations and performance tweaks.