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 https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
!chmod +x Anaconda3-2019.10-Linux-x86_64.sh
!bash ./Anaconda3-2019.10-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/')
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
2 Likes

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

2 Likes

Hi,
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