Running DeepChem HEAD in Colab

In a previous post (Getting DeepChem running in Colab), I explained how to install DeepChem in Colab and hack with it. This method is great if you want to use the last stable release version of DeepChem to do work. But if you’re a DeepChem developer who wants to hack on the latest version in HEAD, this isn’t quite enough to get you started. However, there is a way to install DeepChem HEAD in your colab notebook!

First, make sure that you’re running on a GPU instance on Colab. You can do this by clicking the “Runtime” menu bar, and clicking “Change runtime type” underneath. This will take you to the following panel where you can change to a GPU runtime.

Screen Shot 2020-04-17 at 2.04.01 PM

Our next step is to install the latest stable version of DeepChem. We do this to get all of DeepChem’s dependencies installed:

!wget -c
!chmod +x
!bash ./ -b -f -p /usr/local
!conda install -y -c deepchem -c rdkit -c conda-forge -c omnia deepchem-gpu=2.3.0
import sys

DeepChem HEAD runs on the latest TensorFlow, so we don’t need to tell Colab to use TensorFlow 1.x. Let’s make sure we have a GPU instance running. You can do that by running these commands:

import tensorflow as tf
print("tf.__version__: %s" % str(tf.__version__))
device_name = tf.test.gpu_device_name()
if not device_name:
  raise SystemError('GPU device not found')
print('Found GPU at: {}'.format(device_name))

Now let’s clone DeepChem to our Colab instance

!git clone

To install this version of DeepChem, we need to change directory into the folder we’ve cloned. We need to use the magic %cd command to do this in Colab.

%cd deepchem/

And now we install DeepChem with

!python install

And now you’re all set! Simply run

import deepchem as dc

And you’re all set!


Thanks for the tutorial! When I run in Colab, I seem to get this issue relating to the RDKit installation which causes an error importing deepchem:

ModuleNotFoundError: No module named 'rdkit'

Posted here for others also dealing with similar issues.

Here’s a colab notebook I have running which follows the directions above and is able to run DeepChem HEAD correctly. Could you try using this notebook as a template and seeing if you’re still getting the same error?

1 Like

Will do! Thanks for the link!

Hi Bharath, Have you tried this colab link ? because it is not working anymore. first time i have see any library which have so many configuration issues. Please help because i read your book and choose my topic and now i stuck in configuration .


@mnchoudhary I’m sorry to hear you’re having errors! Have you tried the latest Colab installer command?

I’m sorry for the dust here. We’re undergoing some rapid development and shifting portions of our backend infrastructure over to a new cloud system so we have a bit more construction noise than usual (Pardon our Dust!)

1 Like

Hi Bharath,

Have you started your work with windows + deepchem + jupyter ? because window is widely acceptable environment, still your developed library is available for linux environment only ?

Please share some post or linux where i can find all code which is running because book code is no more running properly .

image Any idea why this error is coming ? Please suggest where i can find entire code is running in any correct environment …

Kind Regards,

Thanks @bharath and @GreenTail ! this above link is working find but still need to refine bcoz in book chapter 11 code is till not working .

image please suggest why this code is showing error

Kind Regards,

It looks like that is an error in the latest version of DeepChem. We are still testing the release so our apologies for any errors that have slipped through. Would you mind raising an issue on the github for the book We will try to fix this as soon as possible.