Skip to content

Container for easily running RDKit + Chem packages with Jupyter notebooks, in Python 3

Notifications You must be signed in to change notification settings

simonkeng/rdkit-jupyter-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RDKit + Chem + Conda + Jupyter + Docker

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.

Instructions

  1. Install Docker.
  2. Clone this repo: git clone https://github.com/simonkeng/rdkit-jupyter-docker.git
  3. Build docker image from Dockerfile
docker build -t run_rdkit_conda .
  1. 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"
  1. Docker will return a container ID, type docker logs <id> passing in the first three characters from the id.

  2. 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.

  3. 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.

Once you're in:

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

Caveats

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.

Acknowledgement

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.

Docker Compose

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

About

Container for easily running RDKit + Chem packages with Jupyter notebooks, in Python 3

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published