question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip install --upgrade without permissions deletes old pip before failing

See original GitHub issue
  • 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:

  1. Old pip getting uninstalled
  2. 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

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

45reactions
ghostcommented, Sep 21, 2016

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/ @JikkuJose sudo chown -R $USER /Library/Python/2.7/

2reactions
nateburleycommented, Jul 12, 2016

Yeah, seriously! I’m having the exact same problem. It’s ridiculous! Does anyone have a fix??

Read more comments on GitHub >

github_iconTop Results From Across the Web

pip install access denied on Windows - python - Stack Overflow
Change your Python installation folder's security permissions by: Open a Python shell; Go to task manager; Find ...
Read more >
Pip upgrade to 22.3 windows10 - Packaging
Hi all, I'm trying to upgrade my pip version. I'm running in cmd promtp as admin and my error is this When I...
Read more >
User Guide - pip documentation v22.3.1
There are 2 upgrade strategies supported: eager : upgrades all dependencies regardless of whether they still satisfy the new parent requirements.
Read more >
PyPI packages in the Package Registry - GitLab Docs
Before you can publish to the Package Registry, you must authenticate. ... image: python:latest run: script: - pip install build twine - python...
Read more >
Configure and use pip with CodeArtifact - AWS Documentation
To use pip to install Python packages from your CodeArtifact repository, you must first configure the pip client with your CodeArtifact repository ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found