Trouble Installing Pip


#1

I can’t get pip installed. I’m on a Mac running 10.12.1 Sierra. I get a long list of red exceptions and then when I run pip list it says command not found. Is all of this supposed to be in the user directory, or the project directory? The directions are not easy to follow for someone who hasn’t done this before.


#2

Sorry to hear you’re having trouble! Can you paste in here what the exceptions are when you try to install pip?


#3

I closed that terminal window. This is what I’m getting now:

Debbies-MacBook-Pro:~ debsmith$ sudo python get-pip.py
Password:
The directory ‘/Users/debsmith/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
The directory ‘/Users/debsmith/Library/Caches/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Requirement already up-to-date: pip in ./Library/Python/2.7/lib/python/site-packages
Debbies-MacBook-Pro:~ debsmith$ pip list
-bash: pip: command not found

Can you please answer the question about where this should be installed?

Thanks


#4

I just got it to install by running sudo easy_install pip, but when I run the command to install virtualenv, I get this:

Exception:
Traceback (most recent call last):
File “/Users/debsmith/Library/Python/2.7/lib/python/site-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/Users/debsmith/Library/Python/2.7/lib/python/site-packages/pip/commands/install.py”, line 342, in run
prefix=options.prefix_path,
File “/Users/debsmith/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py”, line 784, in install
**kwargs
File “/Users/debsmith/Library/Python/2.7/lib/python/site-packages/pip/req/req_install.py”, line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File “/Users/debsmith/Library/Python/2.7/lib/python/site-packages/pip/req/req_install.py”, line 1064, in move_wheel_files
isolated=self.isolated,
File “/Users/debsmith/Library/Python/2.7/lib/python/site-packages/pip/wheel.py”, line 345, in move_wheel_files
clobber(source, lib_dir, True)
File “/Users/debsmith/Library/Python/2.7/lib/python/site-packages/pip/wheel.py”, line 323, in clobber
shutil.copyfile(srcfile, destfile)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”, line 83, in copyfile
with open(dst, ‘wb’) as fdst:
IOError: [Errno 13] Permission denied: ‘/Library/Python/2.7/site-packages/virtualenv.py’


#5

Can you try doing sudo pip install virtualenv?

Before, you got this error:

The directory ‘/Users/debsmith/Library/Caches/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.

So basically it sounds like you have multiple user accounts on your computer and the one you’re running this on isn’t the admin. If the above sudo pip install virtualenv command doesn’t work, try sudo -H pip install virtualenv as the error says to try. :)


#6

The weird thing is I only have one user account and it is the admin. I’ve never run into this error before. I think it was the way I had installed Homebrew. I just followed the instructions here and everything worked perfectly. http://docs.python-guide.org/en/latest/starting/install/osx/. Thanks for trying to troubleshoot.


#8

Thanks for the link, I’ll use that to update/improve my own instructions!