Easily run a Jupyter notebook in Python 3, with all the RDKit dependencies and packages baked in. I hope this provides an "out of the box" solution for anyone who would like to replicate this or this, but does not want to spend time installing packages, dealing with conda envs, dependencies, and getting all the right pieces talking for RDKit and Jupyter to live happily together.
- Install Docker.
- Clone this repo:
git clone https://github.com/simonkeng/rdkit-jupyter-docker.git
- Build docker image from Dockerfile
docker build -t run_rdkit_conda .
- Run the docker container:
docker run -d -p 8888:8888 -t run_rdkit_conda /bin/bash -c "jupyter notebook --notebook-dir=/tmp --ip=* --allow-root"
-
Docker will return a container ID, type
docker logs <id>
passing in the first three characters from the id. -
You should be able to directly copy the URL from the Jupyter log, and visit that URL in your browser. This should work, but if it doesn't, see step 7.
-
If your URL looks something like this:
http://11140d529dec:8888/?token=6ae1624a03f82e5592feaa5123b4086a5dc4f54ed6f6fe8b
Then replace right after http://
(in this example: 11140d529dec
), with 127.0.0.1
. The final URL should look like
http://127.0.0.1:8888/?token=6ae1624a03f82e5592feaa5123b4086a5dc4f54ed6f6fe8b
..but with your token instead of mine. Note this is a Jupyter bug right now, so its very likely that this step won't be necessary by the time you run the container.
These lines are useful for getting started with RDKit in Jupyter.
import rdkit
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import IPythonConsole
from IPython.display import Image
If you are running any other processes on port 8888 (e.g. another Jupyter notebook) then you will likely have problems connecting to the containerized notebook in the browser. I recommend shutting down any other Jupyter notebooks first, before running docker run
.
This implementation was forked from Greg Landrum's rdkit containers repo, but I've tweaked it a bit and updated the things that didn't work for me initially, in hopes to provide an "out of the box" build, relevant to May 2018 developers. All credit goes to Greg and the other RDKit devs.
Once steps 1 and 2 of the Instuctions sections have been completed you can use docker-compose to complete steps 3-7:
Step 3:
docker-compose --build
Step 4-7:
# start container with logs output to terminal
docker-compose up
# or start container in background
docker-compose up -d
# output the container logs
docker-compose logs -f