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 https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
!chmod +x Miniconda3-latest-Linux-x86_64.sh
!bash ./Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local
!conda install -y -c deepchem -c rdkit -c conda-forge -c omnia deepchem-gpu=2.3.0
import sys
sys.path.append('/usr/local/lib/python3.7/site-packages/')

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 https://github.com/deepchem/deepchem.git

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 setup.py install

And now you’re all set! Simply run

import deepchem as dc

And you’re all set!

2 Likes

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?

https://colab.research.google.com/drive/15YHFJlQOMBczy4Clw5pZ35zMc1zgAf1a

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 .

image

@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!)