HOWTO: Install Cytoflow Modules#
To use the Cytoflow modules in a Jupyter notebook or your own code#
Cytoflow is available as a package for the Anaconda scientific Python distribution. You can install cytoflow through the Anaconda Navigator, or by using the command line.
Installing from the command line#
Start
Anaconda Promptfrom the Start Menu (Windows) or Finder (Mac).If you don’t have it already, add the
conda-forgechannel:conda config --add channels conda-forge
Add the
cytoflowchannel:conda config --add channels cytoflow
Create a new environment and install
cytoflowand Jupyter Lab. In this example, the new environment will be calledcf– feel free to choose a different name:conda create --name cf cytoflow jupyterlab
Activate the new environment:
conda activate cf
Launch the Jupyter notebook:
jupyter lab
Create a new Python 3 notebook. In the first cell, type
import cytoflowand pressShift+Enter. If Python doesn’t complain, you’re good to go. (If it does, please submit a bug report!)This method ALSO installs the GUI. You should be able to run it by activating your new environment and running the
cytoflowscript.
To hack on the code#
Cytoflow depends on a huge number of libraries from the Scientific Python
ecosystem, and a change in any one of their APIs will break the cytoflow
library. So, I have pinned the versions of all of cytoflow’s dependencies,
which all but guarantees that you’ll need to install into a virtual environment.
This will ensure that the rest of your Python installation doesn’t break.
Note
cytoflow cannot be installed using pip, except locally
from source with pip install --editable . I am already supporting it
across four operating systems, adding another installer is too much.
Finally, cytoflow relies on one C++ extension. On Linux, installing the
requirements for building it is straightforward. On MacOS it is harder, and
on Windows it is extremely difficult. Instead, as part of rolling a new
release, the appropriate files are made available on
the GitHub releases page.
The procedure below includes instructions for downloading and installing
the appropriate file.
Install the development dependencies
On Ubuntu:
apt-get git swig python-devOn Windows: Install a copy of
git. I use git-for-windowsOn MacOS: Install a copy of
gitfrom the Git website.
Clone the repository, including submodules:
git clone --recurse-submodules https://github.com/cytoflow/cytoflow.git
Edit
environment.ymlas follows:If you’re using Windows, REMOVE the line that reads
- nomkl # [not win]If you’re not using Windows, remove the line that reads
- mkl-service # [win]
Create a new environment. In this example, I have called it
cf_dev. In the new repository you just cloned, say:conda env create --name cf_dev --file environment.yml
Activate the new environment:
conda activate cf_dev
Install
cytoflowin developer’s mode:pip install --editable .
From the GitHub releases page download the appropriate extension file for the version you’re installing.
On Windows (64-bit):
_Logicle.cp312-win_amd64.pydOn MacOS (Intel):
_Logicle-macos-x86_64.soOnw MacOS (Apple Silicon):
_Logicle-macos-arm64.so
Copy the file you just download into the
cytoflow/utility/logicle_ext/folder in your source tree.On MacOS only, rename the file to
_Logicle.so.Test that everything works. Start a
pythoninterpreter and say:import cytoflow
If you don’t get any errors, you’re good to go.
Running the point-and-click GUI program#
There are pre-built bundles available at http://cytoflow.github.io/
Alternately, you can follow the instructions above for installing the
Anaconda package, then run cytoflow through the Anaconda Navigator or
via the command line.