Installation#
Chemprop can either be installed from PyPI via pip, from source (i.e., directly from the git repo) using pip
or the environment.yml
file, or from `Docker`_. The PyPI version includes the vast majority of Chemprop functionality, but some functionality is only accessible when installed from source. We recommend installing chemprop
in a virtual environment (e.g., conda or miniconda). The following sections assume you are using conda
or miniconda
, but you can use any virtual environment manager you like (e.g. mamba
).
Note
Python 3.11 vs. 3.12: Options 1, 2, and 4 below explicitly specify python=3.11
, but for most Chemprop functionality, you can choose to replace python=3.11
with python=3.12
in these commands. We test Chemprop on both versions in our CI. However, Ray Tune, which is an optional dependency that Chemprop relies on for hyperparameter optimization, is not yet compatible with python=3.12
.
Note
CPU-only installation: For the following options 1-3, if you do not have a GPU, you might need to manually install a CPU-only version of PyTorch. This should be handled automatically, but if you find that it is not, you should run the following command before installing Chemprop:
conda install pytorch cpuonly -c pytorch
Option 1: Installing from PyPI#
conda create -n chemprop python=3.11
conda activate chemprop
pip install chemprop
Option 2: Installing from source using pip#
conda create -n chemprop python=3.11
conda activate chemprop
git clone https://github.com/chemprop/chemprop.git
cd chemprop
pip install -e .
Note
You can also use this option to install additional optional dependencies by replacing pip install -e .
with pip install -e ".[hpopt,dev,docs,test,notebooks]"
.
Option 3: Installing from source using environment.yml#
git clone https://github.com/chemprop/chemprop.git
cd chemprop
conda env create -f environment.yml
conda activate chemprop
Option 4: Installing via Docker#
Chemprop can also be installed with Docker, making it possible to isolate the Chemprop code and environment.
To install and run Chemprop in a Docker container, first install `Docker`_.
You may then either pull
and use official Chemprop images or build
the image yourself.
Note
The Chemprop Dockerfile runs only on CPU and does not support GPU acceleration.
Linux users with NVIDIA GPUs may install the nvidia-container-toolkit from NVIDIA and modify the installation instructions in the Dockerfile to install the version of torch which is compatible with your system’s GPUs and drivers.
Adding the --gpus all
argument to docker run
will then allow Chemprop to run on GPU from within the container. You can see other options for exposing GPUs in the Docker documentation.
Users on other systems should install Chemprop from PyPI or source.
Pull Official Images#
docker pull chemprop/chemprop:X.Y.Z
docker run -it chemprop/chemprop:X.Y.Z
Where X
, Y
, and Z
should be replaced with the version of Chemprop you wish to pull
.
For example, to pull chemprop-2.0.0
run
docker pull chemprop/chemprop:2.0.0
Note
Not all versions of Chemprop are available as pre-built images. Visit the Docker Hub page for a list of those that are available.
Note
Nightly builds of Chemprop are available under the latest
tag on Dockerhub and are intended for developer use and as feature previews, not production deployment.
Build Image Locally#
See the build instructions in the top of the Dockerfile
.