Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using OpenMMTools in Google Colab
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Taoaoxiang

This comment has been minimized.

Copy link

@Taoaoxiang 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

This comment has been minimized.

Copy link
Owner Author

@jaimergp jaimergp commented Jul 25, 2019

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

This comment has been minimized.

Copy link

@Taoaoxiang Taoaoxiang commented Jul 25, 2019

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

This comment has been minimized.

Copy link

@Taoaoxiang Taoaoxiang commented Jul 25, 2019

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

@jaimergp

This comment has been minimized.

Copy link
Owner Author

@jaimergp jaimergp commented Jul 21, 2020

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

This comment has been minimized.

Copy link

@drcube98-mrss drcube98-mrss commented Apr 22, 2021

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

This comment has been minimized.

Copy link
Owner Author

@jaimergp jaimergp commented Apr 22, 2021

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