Problems installing and importing MDAnalysis on Google Colaboratory / Questions about MDAnalysis's applications

493 views
Skip to first unread message

Elías C

unread,
Mar 13, 2021, 10:46:06 AM3/13/21
to MDnalysis discussion

Dear Researchers and MDAnalysis Development Group,

I’m an undergraduate student interesting in the study of Molecular Dynamics (MD). I would like to use MDAnalysis library as an alternative to GROMACS and MOLDEN, but I have a problem installing and importing this library in my enviroment, I´m using Google Colaboratory (Colab), because is a free service on cloud, as far as I understand, Colab is capable to compile C/C++ by default, so I was trying pip install method.  Then here starts my problems:

Problems installing and importing MDAnalysis on Google Colaboratory

Is important to mention that Colab now only works on Python 3. Recently I published a question on Stack Overflow detailing what I did (https://stackoverflow.com/questions/66573883/install-and-import-mdanalysis-on-google-colaboratory-for-python-problems). But I resume here:

I tried to install MDAnalysis library using: !pip install MDAnalysis, !pip3 install MDAnalysis and from GitHub with !pip install git+https://github.com/MDAnalysis/mdanalysis.git, but everything fails. I got install the library without Pythorch, writing the following code: !pip2 install MDAnalysis or !pip2.7 install MDAnalysis, that was a really great notice.

One line in Output says: Successfully installed GridDataFormats-0.5.0 MDAnalysis-1.0.1 biopython-1.76 gsd-1.7.0 mmtf-python-1.1.2 tqdm-4.59.0

Despite I have “installed” MDAnalysis I figured out that I can´t import the library, I don´t know why. I simply get that library is not found.

Output: ModuleNotFoundError: No module named 'MDAnalysis'

Resuming my problem in one question: Is it possible to use MDAnalysis in Google Colaboratory?

Questions about applications of MDAnalysis

I’m starting in MD, so, I want to know what kind of projects is it posible to do using MDAnalysis? And some cases, if is it posible, receive recommendations about how. I would like to make three questions:

1.      1. How to simulate water vibrational states? Is basic but I'm not sure about where start, more than by defining the universe.

2.      I have a school Project related to heat transfer, I would like to face it with MD, but i would like, if is posible, simulate a complicated system (from my point of view) with MDAnalysis. My simulation implicate a group of 10nm magnetite particles, a kind of surfractant particles and kerosene molecules, all of them confined. The phenomen that I want to analyse is heat tranfer by conduction and convection under influence of a magnetic field. But using MD I’m going to focus on convection, so I would like to get information about trajectories and impact of magnetite particles over kerosene molecules dynamics. MDAnalysis is capable to define the magnetic field? Or is necesary to use other library? And, one can describe easily confinement space when declare the universe? Or I will have to define an infinite well? There is some advices about this specificly system?

3.      What kind of self-assembled systems can be studied with MDAnalysis? Is this a common practice between MDAnalysis users?

I know that molecular dynamics isn´t trivial and I respect all the research that you carried out, but I wanted to take advantage of this space to find answers that I will never find in other forum, clarify my expectations about MDAnalysis and how to use it smartly. Thaks for your time and have a great day.

Coordial Greetings.

Irfan Alibay

unread,
Mar 13, 2021, 12:45:02 PM3/13/21
to MDnalysis discussion
Hi,

Welcome to MDAnalysis!

> I’m starting in MD, so, I want to know what kind of projects is it posible to do using MDAnalysis?
and
>  I would like to use MDAnalysis library as an alternative to GROMACS and MOLDEN

I might be misunderstanding what you mean here (apologies if that is the case). By your questions it seems like you are looking to run MD simulations with MDAnalysis?
MDAnalysis isn't an MD engine, it is instead a library for handling and analysing coordinates generated by molecular simulation engines.

I'm sure other users can jump in here with suggestions on alternative software to run the types of simulations you are interested in.

>  Problems installing and importing MDAnalysis on Google Colaboratory

It's not really clear what is going on here. Google Colab is a bit of strange ecosystem (at least to me), so I don't think any of the devs have actively looked at using MDA there.

That being said, looking at the stackoverflow, I have a suspicion that it might be down to the same issue with 1.0.1 that is preventing installation on Windows machines. Can you try installing version 1.0.0 instead of 1.0.1?

If that doesn't work, probably the easiest way to debug the whole thing would be to try a manual installation by cloning the MDAnalysis repository (i.e. doing something like what is described here: https://userguide.mdanalysis.org/stable/contributing_code.html). Doing a `python setup.py develop` call (instead of the pip install -e . defined in the userguide) should output enough information for us to work out what is going wrong.

Best regards,

Irfan

Suliman Sharif

unread,
Mar 14, 2021, 9:20:47 AM3/14/21
to mdnalysis-...@googlegroups.com
I guess this is where I might come in because it's not as trivial as a beginner problem getting that installed - I was looking for a way to showcase my plots to the public for the simulations using google colab so I came across this. 

I added a google colab notebook page for you to browse to see how i'm installing conda. The first cell uses condacolab and it's worthwhile to read the docs if you haven't. If the server crashes that's normal :). If you run the next cell it will install the mdanalysis. You can run it by you see I call python scripts in the next cell. 

I use mdanalysis to generate the data to output to files on the server. When those data files are created in the next cell I use plotly to then render the data. I do this because if you launch a notebook inside of a google server to render plotly then the communication between the notebook inside to the notebooke outside is a complete mess.  I update the files using github and rsync it between the platforms. It's stupid but I found out most science folk in my department like google drive as a platform to make comments...
^this one took me awhile to get going (~2-3 hours) so I'll show some unpublished work if you would like. 


3.      What kind of self-assembled systems can be studied with MDAnalysis? Is this a common practice between MDAnalysis users?

I use MDAnalysis to study polymers, more specifically polysaccharides, and surprisingly self-assembly. Haven't published it yet but I've got like a lot of work coming soon to the open access world. I've been enjoying GROMACS and with MDAnalysis it's awesome. Lots of automation can be done - still working on my mdanalysis plotly integration. There's a couple of others in my department that also use this software to study their stuff. 

Lemme know if anything doesn't work or more questions!

--
You received this message because you are subscribed to the Google Groups "MDnalysis discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mdnalysis-discussion/b2c95eae-750e-438a-bc12-c306cf44f1b0n%40googlegroups.com.


--
Suliman Sharif
M.Sc Medicinal Chemistry | University of California, Riverside
B.Sc. Biochemistry | University of Texas at Austin

Suliman Sharif

unread,
Mar 14, 2021, 9:28:25 AM3/14/21
to mdnalysis-...@googlegroups.com
One of the best places you might want to start is the website CHARMM-GUI and read the documents on there. One of my co-workers wrote that piece of software when he was an undergrad 

http://www.charmm-gui.org/ - tbh I think he really likes web apps. It will prepare and build the systems for you and prepare the files for any simulation. If you read the README's it actually also gives you the commands to run on your personal or cluster environment. When I first started MD - took me about a 3-4 days to get the files I needed for a simple polymer. 

hope it helps!

-Sul

Elías C

unread,
Mar 29, 2021, 4:46:16 PM3/29/21
to mdnalysis-...@googlegroups.com
Appreciated Irfan Alibay,

first of all, I apologize for my delayed answer. I'm grateful for your answers.

I might be misunderstanding what you mean here (apologies if that is the case). By your questions it seems like you are looking to run MD simulations with MDAnalysis?
MDAnalysis isn't an MD engine, it is instead a library for handling and analysing coordinates generated by molecular simulation engines.

Yes, I apologize again, I was misunderstanding MDAnalysis uses. In my first look I was interpreting many things wrong.
 
That being said, looking at the stackoverflow, I have a suspicion that it might be down to the same issue with 1.0.1 that is preventing installation on Windows machines. Can you try installing version 1.0.0 instead of 1.0.1?
 
I have tried recently this option, and is a good solution. I didn't know how to install a diferent versión, but found it and it works fantastic. I write:

!pip install MDAnalysis==1.0.0
!pip install MDAnalysisTests==1.0.0

I used MDAnalysis Tests package to prove functionality, and I had no one problem. I had only one advice with Matplotlib, but everything works perfectly:
/usr/local/lib/python3.7/dist-packages/MDAnalysisTests/__init__.py:126: MatplotlibDeprecationWarning:
The 'warn' parameter of use() is deprecated since Matplotlib 3.1 and will be removed in 3.3.
If any parameter follows 'warn', they should be pass as keyword, not positionally.
matplotlib.use('agg', warn=False)
If that doesn't work, probably the easiest way to debug the whole thing would be to try a manual installation by cloning the MDAnalysis repository (i.e. doing something like what is described here: https://userguide.mdanalysis.org/stable/contributing_code.html). Doing a `python setup.py develop` call (instead of the pip install -e . defined in the userguide) should output enough information for us to work out what is going wrong.
 
Furthermore Suliman Sharif and another person (in Stack Overflow) shared two ways to install conda in Colaboratory, and both cases were successful using the conda method in installing and running MDAnalysis in a simple way.  I used MDAnalysisTests to prove some examples, and it works perfectly. So I think that this is the best solution to install last updated version. Sorry, I didn't find how to review the complete error log in Colaboratory, but i'm checking more complete documentation and guides about working on colab.

Thank your for all.

--
You received this message because you are subscribed to a topic in the Google Groups "MDnalysis discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mdnalysis-discussion/eRwcMbZIYxs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mdnalysis-discus...@googlegroups.com.

Elías C

unread,
Mar 29, 2021, 5:22:02 PM3/29/21
to mdnalysis-...@googlegroups.com
Appreciated Suliman Sharif,

First of all, I apologize for my delayed answer. I'm grateful and amazed by your replies. I appreciate you sharing your experience with me.

I added a google colab notebook page for you to browse to see how i'm installing conda. The first cell uses condacolab and it's worthwhile to read the docs if you haven't. If the server crashes that's normal :). If you run the next cell it will install the mdanalysis. You can run it by you see I call python scripts in the next cell.

Yes! This is fantastic, I had no idea that Conda Colab existed, so now I'm checking the documentation as you advise. Thank you because this has let me to explore more packages, with which ones the pip method doesn't work. Everything happens as you mentioned, and I made some examples using MDAnalysisTests.

I use mdanalysis to generate the data to output to files on the server. When those data files are created in the next cell I use plotly to then render the data. I do this because if you launch a notebook inside of a google server to render plotly then the communication between the notebook inside to the notebooke outside is a complete mess.  I update the files using github and rsync it between the platforms. It's stupid but I found out most science folk in my department like google drive as a platform to make comments...
^this one took me awhile to get going (~2-3 hours) so I'll show some unpublished work if you would like.

This is very interesting, I never mind this kind of application and limitations of colaboratory. Thank you for mentioning GitHub and rsync strategy, I think that this will solve many of my problems in the future. I appreciated your comment about unpublished work but I'm starting, so I think that I will not understand many things, but I would like to send you a more personal email to ask you for advice and guidance in relation to MDS in general.

3.      What kind of self-assembled systems can be studied with MDAnalysis? Is this a common practice between MDAnalysis users?

I use MDAnalysis to study polymers, more specifically polysaccharides, and surprisingly self-assembly. Haven't published it yet but I've got like a lot of work coming soon to the open access world. I've been enjoying GROMACS and with MDAnalysis it's awesome. Lots of automation can be done - still working on my mdanalysis plotly integration. There's a couple of others in my department that also use this software to study their stuff.

It's incredible how GROMACS and MDAnalysis can work together, this is important to me because is an outlook to MDAnalysis applications.

I'm very interested in your study of polysaccharides, self-assembly is one of the most amazing phenomena, I would like to study it at planetary scale, but also I would like to know how research is carried out at microscopic level, but more importantly, how to predict that self-assembly it will be there, I would like to share my little experience working with a macroscopic self-assembly system. I would like to know if you have a preferred social media like ResearchGate to get information about your publications? I think that I found your profile in GitHub, Medium and Google Scholar. If you agree, I may send you an email.

Coordial Greetings.
 
On Sat, Mar 13, 2021 at 12:45 PM Irfan Alibay <ial...@mdanalysis.org> wrote:
Hi,

Welcome to MDAnalysis!

> I’m starting in MD, so, I want to know what kind of projects is it posible to do using MDAnalysis?
and
>  I would like to use MDAnalysis library as an alternative to GROMACS and MOLDEN

I might be misunderstanding what you mean here (apologies if that is the case). By your questions it seems like you are looking to run MD simulations with MDAnalysis?
MDAnalysis isn't an MD engine, it is instead a library for handling and analysing coordinates generated by molecular simulation engines.

I'm sure other users can jump in here with suggestions on alternative software to run the types of simulations you are interested in.

>  Problems installing and importing MDAnalysis on Google Colaboratory

It's not really clear what is going on here. Google Colab is a bit of strange ecosystem (at least to me), so I don't think any of the devs have actively looked at using MDA there.

That being said, looking at the stackoverflow, I have a suspicion that it might be down to the same issue with 1.0.1 that is preventing installation on Windows machines. Can you try installing version 1.0.0 instead of 1.0.1?

If that doesn't work, probably the easiest way to debug the whole thing would be to try a manual installation by cloning the MDAnalysis repository (i.e. doing something like what is described here: https://userguide.mdanalysis.org/stable/contributing_code.html). Doing a `python setup.py develop` call (instead of the pip install -e . defined in the userguide) should output enough information for us to work out what is going wrong.

Best regards,

Irfan

--
You received this message because you are subscribed to the Google Groups "MDnalysis discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mdnalysis-discussion/b2c95eae-750e-438a-bc12-c306cf44f1b0n%40googlegroups.com.


--
Suliman Sharif
M.Sc Medicinal Chemistry | University of California, Riverside
B.Sc. Biochemistry | University of Texas at Austin

--
You received this message because you are subscribed to the Google Groups "MDnalysis discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-discus...@googlegroups.com.

Elías C

unread,
Mar 29, 2021, 5:58:56 PM3/29/21
to mdnalysis-...@googlegroups.com
One of the best places you might want to start is the website CHARMM-GUI and read the documents on there. One of my co-workers wrote that piece of software when he was an undergrad 

http://www.charmm-gui.org/ - tbh I think he really likes web apps. It will prepare and build the systems for you and prepare the files for any simulation. If you read the README's it actually also gives you the commands to run on your personal or cluster environment. When I first started MD - took me about a 3-4 days to get the files I needed for a simple polymer.

This is very impressive, thanks for sharing it with me. I was checking the materials, and there are a lot of things that I never imagined like an undergrad student, I can't believe it. I'm very grateful.

I apologize because in the last email I used "I never mind" as "I never imagined", I got a confusion. I didn't want to be rude. I actually wanted to express "I never imagined".

--
You received this message because you are subscribed to the Google Groups "MDnalysis discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-discus...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages