Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong permissions when installing from source on Linux #3450

Closed
jowr opened this issue Sep 2, 2014 · 5 comments
Closed

Wrong permissions when installing from source on Linux #3450

jowr opened this issue Sep 2, 2014 · 5 comments

Comments

@jowr
Copy link
Contributor

jowr commented Sep 2, 2014

Hi all,
I might have found a little bug or I might miss something obvious.

I installed my initial version via pip sudo pip install matplotlib, which gave me the old python -c 'import matplotlib; print matplotlib.__version__'; 1.4.0. I made a sudo pip uninstall matplotlib, cloned the git repository and ran rm -rf build; python setup.py clean; python setup.py build; sudo python setup.py install and ended up with an unusable installation:

python -c 'import matplotlib; print matplotlib.__version__' 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute '__version__'

Changing the permissions with sudo chmod -R a+r /usr/local/lib/python2.7/dist-packages/matplotlib-1.5.x-py2.7-linux-i686.egg solved that issue yielding python -c 'import matplotlib; print matplotlib.__version__'; 1.5.x.

Could this be included in the installation process?

I am running Linux - 3.0.0-32-generic-pae, python --version yields Python 2.7.2+ and numpy is 1.8.2.

@jenshnielsen jenshnielsen added this to the v1.4.x milestone Sep 2, 2014
@tacaswell
Copy link
Member

If this is a bug, I suspect it is in setup tools, not on our end, but giving all read permissions seems a tad sketchy to do by default.

I would also strongly discourage installing anything via sudo into folders controlled by your systems package manager in an ad-hoc manner (if you really want to install it system-wide wrap it in the packaging system for your distro).

Either use the --user option, venvs, or conda so you can install and run packages from areas of disk you (as a normal user) have full permission on.

@jowr
Copy link
Contributor Author

jowr commented Sep 2, 2014

OK, thanks for the reply. I just came across this issue trying to run some tests. Normally I don't mess around with the system directories without the help of pip.
Feel free to close this issue, if you do not consider it relevant. However, one could consider adding some information on this to https://github.com/matplotlib/matplotlib/blob/master/INSTALL#L126 ...

@jenshnielsen
Copy link
Member

AFIK most linux distributions install packages under the package manager into /usr/ while packages in /usr/local are not under control of the package manager.

@efiring
Copy link
Member

efiring commented Sep 2, 2014

@tacaswell, @jowr is using /usr/local correctly; as @jenshnielsen notes, the package manager works only with /usr. There is nothing at all wrong with using sudo to install to /usr/local, and everything in /usr/local/lib/pythonx.x/dist-packages should be world-readable.
I have done this sort of direct installation many times on many linux machines, without this permission problem. I tried it just now with mpl master, and it works. I have no idea why it didn't work in the case described by @jowr, but I don't think it calls for changing anything in mpl. It was some odd fluke, presumably resulting from some detritus left by the earlier pip sequence, or... Who knows? I'm closing this, because I don't think there is anything for us to do about it.

@efiring efiring closed this as completed Sep 2, 2014
@tacaswell
Copy link
Member

Fair enough. I spent a lot of time working on systems where I didn't have root, got in the habit of doing all my python dev work in my home directory, and never sorted out the system-wide stuff. I have also seen too many SO questions that go like "I ran a zillion sudo commands and now my system is broken" so my knee jerk reaction to sudo is "don't".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants