An open-source toolkit for computational pathology and machine learning.
Tutorials, example vignettes, technical notes, and a complete API reference can be found at docs.pathml.org
There are several ways to install
pip installfrom PyPI (recommended for users)
Options (1) and (2) require that you first install all external dependencies:
We recommend using conda for environment management. Download Miniconda here
Note: these instructions are for Linux. Commands may be different for other platforms.
Create conda environment:
conda create --name pathml python=3.8 conda activate pathml
Install external dependencies (Linux) with Apt:
sudo apt-get install openslide-tools g++ gcc libblas-dev liblapack-dev
Install external dependencies (MacOS) with Brew:
brew install openslide
Install OpenJDK 8:
conda install openjdk==8.0.152
PathML from PyPI:
pip install pathml
git clone https://github.com/Dana-Farber-AIOS/pathml.git cd pathml
Create conda environment:
conda env create -f environment.yml conda activate pathml
PathML from source:
pip install -e .
First, download or build the PathML Docker container:
docker pull pathml/pathml:latest
Optionally specify a tag for a particular version, e.g.
docker pull pathml/pathml:2.0.2. To view possible tags,
please refer to the PathML DockerHub page.
git clone https://github.com/Dana-Farber-AIOS/pathml.git cd pathml docker build -t pathml/pathml .
Then connect to the container:
docker run -it -p 8888:8888 pathml/pathml
The above command runs the container, which is configured to spin up a jupyter lab session and expose it on port 8888.
The terminal should display a URL to the jupyter lab session starting with
Navigate to that page and you should connect to the jupyter lab session running on the container with the pathml
environment fully configured. If a password is requested, copy the string of characters following the
token= in the
Note that the docker container requires extra configurations to use with GPU.
Note that these instructions assume that there are no other processes using port 8888.
Please refer to the
Docker run documentation for further instructions
on accessing the container, e.g. for mounting volumes to access files on a local machine from within the container.
For more information, please refer to the installation instructions on the PathML GitHub repository
CUDA must be installed to use GPU acceleration for model training or other tasks. For the most up-to-date instructions, refer to the official PyTorch installation instructions.
Check the version of CUDA:
Install correct version of
# update this command with your CUDA version number conda install cudatoolkit=11.0
After installing PyTorch, optionally verify successful PyTorch installation with CUDA support:
python -c "import torch; print(torch.cuda.is_available())"
If you use
PathML in your work, please cite our paper:
Rosenthal J, Carelli R, Omar M, Brundage D, Halbert E, Nyman J, Hari SN, Van Allen EM, Marchionni L, Umeton R, Loda M. Building tools for machine learning and artificial intelligence in cancer research: best practices and a case study with the PathML toolkit for computational pathology. Molecular Cancer Research, 2021. DOI: 10.1158/1541-7786.MCR-21-0665
The GNU GPL v2 version of PathML is made available via Open Source licensing. The user is free to use, modify, and distribute under the terms of the GNU General Public License version 2.
Commercial license options are also available.
Questions? Comments? Suggestions? Get in touch!