Becksteinlab / GromacsWrapper

GromacsWrapper wraps system calls to GROMACS tools into thin Python classes (GROMACS 4.6.5 - 2024 supported).
https://gromacswrapper.readthedocs.org
GNU General Public License v3.0
169 stars 53 forks source link

`sudo pip install` broken #40

Closed bieniekmateusz closed 8 years ago

bieniekmateusz commented 8 years ago

Dear GromacswRappers,

I've just installed the GromacsWrapper using pip. Unfortunately, when I try to import any of the available tools, I run into this:

In [7]: import gromacs

ImportError Traceback (most recent call last)

in () ----> 1 import gromacs /usr/local/lib/python2.7/dist-packages/gromacs/**init**.py in () 184 **all** = ['config', 'tools', 'cbook', 'fileformats'] 185 --> 186 from . import fileformats 187 188 # Note: analysis not imported by default (requires additional pre-requisites) ImportError: cannot import name fileformats

Hints on how to resolve it are welcome. Thanks

bieniekmateusz commented 8 years ago

Apparently, the first time I tried to import gromacs the errors was different:

OSError Traceback (most recent call last)

in () ----> 1 import gromacs /usr/local/lib/python2.7/dist-packages/gromacs/**init**.py in () 197 198 # Import configuration before anything else --> 199 from . import config 200 201 /usr/local/lib/python2.7/dist-packages/gromacs/config.py in () 657 # see http://peak.telecommunity.com/DevCenter/PythonEggs#accessing-package-resources 658 GridMAT_MD = resource_filename(**name**,'external/GridMAT-MD_v1.0.2/GridMAT-MD.pl') --> 659 os.chmod(GridMAT_MD, 0755) 660 661 OSError: [Errno 1] Operation not permitted: '/usr/local/lib/python2.7/dist-packages/gromacs/external/GridMAT-MD_v1.0.2/GridMAT-MD.pl'

I resolved the error using a workaround: sudo chown myusername /usr/local/lib/python2.7/dist-packages/gromacs/external/GridMAT-MD_v1.0.2/GridMAT-MD.pl

orbeckst commented 8 years ago

Dear GromacswRappers

That's just awesome ;-)

I normally install GW as a local user

pip install --user

or in a virtualenv and I tried out both 0.4.0 (the last release) and the current develop 0.4.1.dev0 and both worked for me (import gromacs).

bieniekmateusz commented 8 years ago

This is the first time I hear about local user installation in pip. Sounds like a useful option, thanks.

The version is 0.4.0

I used the following command: sudo pip install GromacsWrapper

orbeckst commented 8 years ago

Hm, sudo pip install should not give any issues.

Could you nevertheless try to

  1. Uninstall the global package (the one one in /usr/local)
  2. Try --user installation.
bieniekmateusz commented 8 years ago

Looks like it's working:

  1. sudo pip uninstall GromacsWrapper
  2. pip install GromacsWrapper --user

Importing the gromacs package does not give any errors.

orbeckst commented 8 years ago

I am glad that it's working now but eventually I'd like to find out why a sudo install failed.

On 1 Apr, 2016, at 02:08, Mateusz Bieniek wrote:

Looks like it's working:

� sudo pip uninstall GromacsWrapper � pip install GromacsWrapper --user Importing the gromacs package does not give any errors.

� You are receiving this because you commented. Reply to this email directly or view it on GitHub

Oliver Beckstein * orbeckst@gmx.net skype: orbeckst * orbeckst@gmail.com

bieniekmateusz commented 8 years ago

Let me know if I can assist further.

The error was that the os.chmod is used in python:

--> 659 os.chmod(GridMAT_MD, 0755)

However, the file belongs to root (likely because of sudo during installation). The python interpreter however is executed in the user mode. This all leads to the error:

Operation not permitted: '/usr/local/lib/python2.7/dist-packages/gromacs/external/GridMAT-MD_v1.0.2/GridMAT-MD.pl'

orbeckst commented 8 years ago

Thanks, that's a very useful diagnosis. I renamed the issue and I am reopening it because installation with sudo pip install should work.

orbeckst commented 8 years ago

Btw, the most likely solution is going to be to remove gridmatmd --- I don't think that anyone is using it and there are better tools available nowadays.

orbeckst commented 8 years ago

@bieniekmateusz can you check if the latest development version fixed this problem and let us know?