Installation of CellProfiler 4 from source on MacOS M1 - CellProfiler/CellProfiler GitHub Wiki

Below are two sets of installation instructions for installation of CellProfiler from source on Macs using the new Apple M1 processor.

  1. Install homebrew Python
  2. Install CellProfiler inside a conda environment
    • For less conflict problems, it is recommended to follow the conda installation

Brew Python installation

  1. Install brew

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  2. Update brew

    brew update
    
  3. Install python 3.8

    brew install [email protected]
    echo export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH" >> ~/.zshrc
    
  4. Install Java

    brew install java
    
  5. For the system Java wrappers to find this JDK, symlink it with

    sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
    
  6. Set version in zshrc

    echo "export JAVA_HOME=\"\$(/usr/libexec/java_home -v 1.8)\"" >> ~/.zshrc
    source ~/.zshrc
    
  7. Brew install the packages requirements

    brew install freetype mysql
    
  8. Direct to brew openssl

    export LDFLAGS="-L$(brew --prefix)/opt/openssl/lib"
    
  9. Install hdf5

    brew install hdf5
    
  10. Make sure to get the version directory correct for the version installed. Find with ls $(brew --prefix)/Cellar/hdf5

    export HDF5_DIR=/opt/homebrew/Cellar/hdf5/1.14.1/
    
  11. Install cellprofiler

    pip3 install "cellprofiler==4.2.6"
    
  12. In the CellProfiler directory, start CellProfiler with:

    python3 -m cellprofiler
    

Conda installation

These are instructions to install CellProfiler 4.2.5 and they may need to be modified accordingly to install other versions.

  1. Install conda using Anaconda or minimally with miniconda

  2. Create a Python 3.8 environment with conda

    conda create --name cellprofiler -y python=3.8
    
  3. Activate the conda environment

    conda activate cellprofiler
    
  4. Install java with conda

    conda install openjdk
    
  5. Install dependencies from conda

    1. python.app is required for pythonw
    conda install libgfortran h5py mysqlclient python.app 
    
  6. Install CellProfiler

     pip install "cellprofiler==4.2.6"
    
  7. Run CellProfiler from within its directory

    • Execute this command (note the w after python, this uses the python.app package from step 2)
    pythonw -m cellprofiler