Skip to content

Instantly share code, notes, and snippets.

@oyvindio
Created May 25, 2011 18:53
Show Gist options
  • Save oyvindio/991630 to your computer and use it in GitHub Desktop.
Save oyvindio/991630 to your computer and use it in GitHub Desktop.
sudo pip install <stuff> with a restrictive umask set can cause this issue
shredder ~ $ umask
0022
shredder ~ $ sudo pip install django # random package, for illustration purposes
Downloading/unpacking django
Downloading Django-1.3.tar.gz (6.5Mb): 6.5Mb downloaded
Running setup.py egg_info for package django
Installing collected packages: django
Running setup.py install for django
changing mode of build/scripts-2.7/django-admin.py from 644 to 755
changing mode of /usr/bin/django-admin.py to 755
Successfully installed django
Cleaning up...
shredder ~ $ python2
Python 2.7.1 (r271:86832, Apr 15 2011, 12:09:10)
[GCC 4.5.2 20110127 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> dir(django)
['VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'get_version']
>>>
shredder ~ $ sudo pip uninstall django
Uninstalling Django:
/usr/bin/django-admin.py
/usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg-info
/usr/lib/python2.7/site-packages/django
Proceed (y/n)? y
Successfully uninstalled Django
# Obviously, this worked fine.
shredder ~ $ umask 0027
shredder ~ $ sudo pip install django
Downloading/unpacking django
Downloading Django-1.3.tar.gz (6.5Mb): 6.5Mb downloaded
Running setup.py egg_info for package django
Installing collected packages: django
Running setup.py install for django
changing mode of build/scripts-2.7/django-admin.py from 640 to 755
changing mode of /usr/bin/django-admin.py to 755
Successfully installed django
Cleaning up...
shredder ~ $ python2
Python 2.7.1 (r271:86832, Apr 15 2011, 12:09:10)
[GCC 4.5.2 20110127 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named django
>>>
shredder ~ $ ls -l /usr/lib/python2.7/site-packages/ | grep django
drwxr-x--- 17 root root 4096 May 25 19:40 django
# The django module is only readable by root the user and root the group; it is installed, but only root can actually use it!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment