Regarding installing module MDAnalysis.lib.distances

42 views
Skip to first unread message

Deepshikha Ghosh 19310001

unread,
Aug 12, 2022, 2:24:47 AM8/12/22
to MDnalysis discussion
Dear Users

I am trying to calculate the distance between two residues (only for CA atoms) and this is the script which I am using:


import numpy as np
import MDAnalysis as mda
import pandas as pd
from MDAnalysis.lib.distance import distance_array

u= mda.Universe("protein_2000ns_autopsf.psf" , "protein_2000ns.dcd")
residues1 = u.select_atoms('protein and resid 1:85').residues
residues2 = u.select_atoms('protein and resid 1:85').residues

But I am getting the following error: No module named 'MDAnalysis.lib.distance'

I tried to install the above stated module but I am not able to do so (Note: I already have MDAnalysis installed). Any kind of help will be appreciated.

Thanks & Regards
Deepshikha Ghosh
IIT Gandhinagar

Hugo Macdermott-Opeskin

unread,
Aug 12, 2022, 2:59:27 AM8/12/22
to mdnalysis-...@googlegroups.com
Hi Deepshikha and welcome! 

Just a simple bit of misspelling as far as I can see. You need  

MDAnalysis.lib.distances

Not 

MDAnalysis.lib.distance

Cheers

Hugo 

--
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/ea562899-dba1-4dc0-9da5-60910d114146n%40googlegroups.com.
--
Hugo MacDermott-Opeskin

Deepshikha Ghosh 19310001

unread,
Aug 12, 2022, 3:30:14 AM8/12/22
to mdnalysis-...@googlegroups.com
Thankyou for your response.

I tried correcting it but still it is not working. I tried installing in the following manner:

conda config --add channels conda-forge
conda install MDAnalysis.lib.distances

Am I doing it the wrong way?

Thanks & Regards
Deepshikha Ghosh
IIT Gandhinagar 

Hugo Macdermott-Opeskin

unread,
Aug 12, 2022, 3:33:47 AM8/12/22
to mdnalysis-...@googlegroups.com

You do not need to (/it’s I not possible to) conda install individual sub modules of MDAnalysis. The distances module should already be a part of your existing MDAnalysis installation. Can you import MDAnalysis currently ?


--
Hugo MacDermott-Opeskin

Deepshikha Ghosh 19310001

unread,
Aug 12, 2022, 4:25:27 AM8/12/22
to mdnalysis-...@googlegroups.com
Thankyou for your response. Yes I can import MDAnalysis currently, but when I try to use this particular module named " MDAnalysis.lib.distances", it is showing an error.

Thanks & Regards

Deepshikha Ghosh
IIT Gandhinagar


Hugo Macdermott-Opeskin

unread,
Aug 12, 2022, 5:09:58 AM8/12/22
to mdnalysis-...@googlegroups.com
Would you be able to post the full error trace so I can see what it might be ?

--
Hugo MacDermott-Opeskin

Deepshikha Ghosh 19310001

unread,
Aug 12, 2022, 11:51:26 AM8/12/22
to mdnalysis-...@googlegroups.com
Kindly find the attachment.

Thanks & Regards
Deepshikha Ghosh
IIT Gandhinagar
check1.jpg

Oliver Beckstein

unread,
Aug 12, 2022, 11:55:51 AM8/12/22
to mdnalysis-discussion
Hello Deepshikha Ghosh,

According to your error message, you are trying to `import MDAnalysis.lib.distance` but this is the WRONG name. Instead, use

import MDAnalysis.lib.distances

(the name of the module is ‘distances’ https://docs.mdanalysis.org/stable/documentation_pages/lib/distances.html#low-level-modules-for-mdanalysis-lib-distances ) — Hugo had already pointed out this problem in an earlier message.

Given that you’re using a notebook, I suggest you try “TAB-completion” when writing your code. This approach will automatically give you the correct names when you write your import statement.

Best,
Oliver


--
Oliver Beckstein (he/his/him)

GitHub: @orbeckst

MDAnalysis – a NumFOCUS fiscally sponsored project





Deepshikha Ghosh 19310001

unread,
Aug 14, 2022, 11:01:00 AM8/14/22
to MDnalysis discussion
Thankyou for your response.

Regards
Deepshikha Ghosh
IIT Gandhinagar

Reply all
Reply to author
Forward
0 new messages