pip: pip install --upgrade without permissions deletes old pip before failing
- Pip version: 8.1-1
- Python version: 2.7.11
- Operating System: 10.9.5
Description:
Running pip install --upgrade pip, without proper permissions, results in:
- Old pip getting uninstalled
- New pip failing to install due to permissions issues when writing files
Now the system lacks pip entirely.
What I’ve run:
I have pip installed with homebrew, but forgot about this. I ran:
pip install --upgrade pip
Got back:
Collecting pip
Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
100% |████████████████████████████████| 1.2MB 270kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.1
Uninstalling pip-8.1.1:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 726, in install
requirement.uninstall(auto_confirm=True)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 746, in uninstall
paths_to_remove.remove(auto_confirm)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/usr/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 303, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/pip-8.1.1.dist-info/DESCRIPTION.rst'
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Then I ran:
sudo pip install --upgrade pip
And got back:
sudo: pip: command not found
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 1
- Comments: 15 (5 by maintainers)
You don’t have rw permission to the directories. Assuming you have administrator rights, you can change the permissions with
sudo chown -R $USER /absolute/path/to/directory
. If you’re running OS X 10.11+, you’ll probably also need disable the System Integrity Protection, but don’t forget to reenable it after you’re done (just to be safe).@tallakahath
sudo chown -R $USER /usr/local/lib/python2.7/
@JikkuJosesudo chown -R $USER /Library/Python/2.7/
Yeah, seriously! I’m having the exact same problem. It’s ridiculous! Does anyone have a fix??