Skip to content

Instantly share code, notes, and snippets.

@jaimergp
Last active April 22, 2021 16:32
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jaimergp/45015e75b4ae5f79a03d24e53b74ac1a to your computer and use it in GitHub Desktop.
Save jaimergp/45015e75b4ae5f79a03d24e53b74ac1a to your computer and use it in GitHub Desktop.
Using OpenMMTools in Google Colab
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Taoaoxiang
Copy link

Taoaoxiang commented Jul 24, 2019

Hello Jaime, this is Oliver. I tried to install openmm couple times and it didn't work. So I googled "openmm" and "colab" and found your tutorial. Then I followed every step of your tutorial, but I got totally different result. It still doesn't work for me.
So in this step
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages/')
It seems like they moved "site-packages" under python3.7. Even after appending the site-packages under python3.7, I still get the same issue.
"Error message: No module named '_openmm'"
I wonder if I didn't do it correctly or openmm has changed some setting.
Thank you!

@jaimergp
Copy link
Author

Hi Oliver, if they have migrated to Python 3.7, then you should also download the latest Miniconda (instead of v4.5.4). I will test this later this week and update this notebook. Thanks for the report!

@Taoaoxiang
Copy link

Hi Oliver, if they have migrated to Python 3.7, then you should also download the latest Miniconda (instead of v4.5.4). I will test this later this week and update this notebook. Thanks for the report!

Hello Jaime,
Thank you for your reply!
I have tried again using Anaconda2, and it works!

!wget -c https://repo.anaconda.com/archive/Anaconda2-2019.03-Linux-x86_64.sh
!bash ./Anaconda2-2019.03-Linux-x86_64.sh -b -f -p /usr/local
!conda install -y --prefix /usr/local -c omnia/label/cuda100 -c conda-forge openmm
import sys
sys.path.append('/usr/local/lib/python2.7/site-packages/')
import simtk.testInstallation
simtk.testInstallation.main()

Still, it would be really helpful if you could get it work on Python3 (as OpenMM recommended on their website). I haven't seen any error or issue using Python2 yet.

@Taoaoxiang
Copy link

Sorry I forgot to mention that we have to change the runtime type to Python2 and of course with GPU before get started.

@jaimergp
Copy link
Author

Hi Oliver, a year later, I found out what was happening: the conda solver sneakily updates python, which creates all sorts of problems. Make sure to add python=3.6 to the list of packages passed to conda install and it should work ok!

@drcube98-mrss
Copy link

Hi, my name is Ted. I tried running your code and encountered the following error. Would be grateful if any of you could help me figure it out. I got the error while running simtk.testInstallation.main().

Failed to import OpenMM packages; OpenMM will not work.
Make sure OpenMM is installed and the library path is set correctly.

Error message: cannot import name '_openmm' from 'simtk.openmm' (/usr/local/lib/python3.6/site-packages/simtk/openmm/init.py)
An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

@jaimergp
Copy link
Author

Hi @drcube98-mrss! Colab has changed a bit its internals but I didn't update this notebook. Take a look at my condacolab project for a new updated workflow. You can see an example here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment