Getting DeepChem running in Colab

I’ve recently started hacking with DeepChem in Colab. I thought it might be useful to post the recipe here for any other folks who are interested in using Colab. Paste the following into your first cell in your Colab notebook:

!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
import deepchem as dc

Happy hacking! Post on this issue if you run into any problems

Edit: Google’s updated their Colab instances to use TensorFlow 2.X by default. The last stable version of DeepChem is still on TensorFlow 1.X. You can make sure your colab notebook runs by adding the following command at the top of your Colab notebook:

%tensorflow_version 1.x

Thank you for this. I hope to be use Colab notebook as I often have problem installing Deepchem on Windows using Anaconda.


Thank you for sharing this code. I’ve used it successfully in the past in Colab, but have been recently been running into an:

ImportError: cannot import name ‘NewCheckpointReader’

Do you have any suggestions here?
Thank you

1 Like

I think Google colab just updated to use TF2.X as default. You can fix this by adding a magic command to the top of your colab notebook:

%tensorflow_version 1.x

I’ll update the post above with this command too

1 Like

The latest command is here. Please try it!

%tensorflow_version 1.x
!curl -Lo
import deepchem_installer

For some reason, using this command in Colab throws an error:

TypeError: install() got an unexpected keyword argument 'version'

Do you know by a chance how to fix the command?

1 Like

You try the new command!

!curl -Lo
import conda_installer
!/root/miniconda/bin/conda info -e
!pip install --pre deepchem
import deepchem

Now, we are updating the tutorial notebooks for the latest DeepChem version.