To preface, I'm currently running OSX 10.9.1 with Python 2.7.
I would like to install Python packages using easy_install
(in this example, pip
). First I try:
easy_install pip
And then I get an error that says that I do not have write access to the site-packages
directory. No problem:
sudo easy_install pip
Everything downloads fine. The following shows the Bash session I have after installing pip
:
$ pip
-bash: /usr/local/bin/pip: Permission denied
$ cd /usr/local/bin/pip
$ ls -l
...
-rwx------ 1 root admin 275 Jan 10 11:05 pip
...
$ chmod 754 pip
chmod: Unable to change file mode on pip: Operation not permitted
$ sudo chmod 754 pip
$ pip
Traceback (most recent call last):
File "./pip", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.macosx-10.8-intel/egg/pkg_resources.py", line 3007, in <module>
File "build/bdist.macosx-10.8-intel/egg/pkg_resources.py", line 728, in require
requirements specified when this environment was created, or False
File "build/bdist.macosx-10.8-intel/egg/pkg_resources.py", line 626, in resolve
pkg_resources.DistributionNotFound: pip==1.5
Ok, so maybe there some of the permissions are still messed up. Here's what Finder shows me when I view /Library/Python/2.7/site-packages/
:
And here's what ls -l
returns when viewing that same directory:
...
drwx------ 4 root wheel 136 Jan 10 11:24 pip-1.5-py2.7.egg
...
Ok, so I obviously don't have permission to use pip
still because I don't have execute permission on the archive file. How about:
$ chmod 754 pip-1.5-py2.7.egg
chmod: Unable to change file mode on pip-1.5-py2.7.egg/: Operation not permitted
$ sudo chmod 754 pip-1.5-py2.7.egg
$ pip
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==1.5', 'console_scripts', 'pip')()
File "build/bdist.macosx-10.8-intel/egg/pkg_resources.py", line 378, in load_entry_point
def get_resource_stream(manager, resource_name):
File "build/bdist.macosx-10.8-intel/egg/pkg_resources.py", line 2565, in load_entry_point
section = line[1:-1].strip()
ImportError: Entry point ('console_scripts', 'pip') not found
My hypothesis is that all of the permissions are screwed up because I used sudo
and now I'm just chasing around permissions. This may be wrong, though. I never remember having this problem before upgrading to OSX 10.9.
My questions are: do Unix systems always do this with sudo
, even though I'm the computer's administrator? Is there a way for me to permanently correct this so that I actually have permission to run installed packages? Do you think there is a setting somewhere on my system that's incorrect?