MDAnalysis / RotamerConvolveMD

Analysis of molecular dynamics trajectories or conformational ensembles in terms of spin-label distances as probed in double electron-electron resonance (DEER) experiments.
https://www.mdanalysis.org/RotamerConvolveMD
GNU General Public License v2.0
7 stars 4 forks source link

Possible bug wih MDAnalysis 0.16.2 and python 2.7 #32

Closed lcupellini closed 4 years ago

lcupellini commented 5 years ago

Hello, I'm running rotamerConvolveMD 1.3.0 under Linux OpenSuse with python 2.7

I have installed the latest MDAnalysis (0.16.2) with conda, and then rotamerConvolveMD 1.3.0 with pip.

When trying to run convolve-mtss-rotamers.py, there is the following exception in rotcon/library.py:

File "/home/software/miniconda2/bin/convolve-mtss-rotamers.py", line 107, in <module>
useNOelectron=options.useNOelectron)
File "/home/software/miniconda2/lib/python2.7/site-packages/rotcon/convolve.py", line 136, in init
self.lib = library.RotamerLibrary(kwargs.get('libname', 'MTSSL 298K'))
File "/home/software/miniconda2/lib/python2.7/site-packages/rotcon/library.py", line 105, in init
self.lib[k] = find_file(self.lib[k])
File "/home/software/miniconda2/lib/python2.7/site-packages/rotcon/library.py", line 64, in find_file
return MDAnalysis.core.util.realpath(filename)
AttributeError: 'module' object has no attribute 'util'

I could fix the exception and run the script by adding

import MDAnalysis.core.util

after the import of MDAnalysis

orbeckst commented 5 years ago

Thanks for the report.

Please note that MDAnalysis is at 0.20.1 and 0.16.2 is pretty old – please update. (0.20.1 supports Python 2.7).

orbeckst commented 5 years ago

I tried it with

>>> import MDAnalysis
>>> MDAnalysis.__version__
'0.20.1'

and RotamerConvolve 1.3.0 and I don't get the error – it just works as expected

>>> import rotcon.library
>>> rotcon.library.RotamerLibrary('MTSSL 298K 2015')
<RotamerLibrary 'MTSSL 298K 2015' by Gunnar Jeschke with 216 rotamers>

Did you try with MDAnalysis 0.20.1 and does your error persist, @lcupellini ?

lcupellini commented 4 years ago

Thank you @orbeckst for the response. I have investigated the error, which appears whenever I want to use as a library a dcd file in my current working directory (I was copying the library dcd files in my directory). The error persists in version 0.20.1

The exception is thrown in the find_file fundtion in library.py, at line 54

    if os.path.exists(filename):
        return MDAnalysis.core.util.realpath(filename)

You can reproduce the error by creating any file (e.g. test.txt) in your current working directory, then doing:

>>> import MDAnalysis, rotcon.library
>>> MDAnalysis.__version__
'0.20.1'
>>> rotcon.library.find_file('test.txt')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/software/amber18/miniconda/envs/rotcon/lib/python2.7/site-packages/rotcon/library.py", line 64, in find_file
    return MDAnalysis.core.util.realpath(filename)
AttributeError: 'module' object has no attribute 'util'

Of course, that line of code is not reached unless you search for a file in your current directory.

orbeckst commented 4 years ago

Ok, thanks for the detailed description. I could reproduce the failure. I am pushing a fix.

orbeckst commented 4 years ago

@lcupellini if you install from source then this issue should be fixed.