Unable to upgrade pip

10,954

Solution 1

You have to run it with sudo unless you are using a virtualenv. The problem is that you don't have the permission to change that module. With sudo, you are giving administrator's permissions to update it.

sudo pip install --upgrade pip

Solution 2

The Error

OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-8.1.2.dist-info/DESCRIPTION.rst'

showed that you are not allowed to upgrade pip as a regular user, You have to run it as sudoer

sudo pip install --upgrade pip

Share:
10,954
Imperator123
Author by

Imperator123

Updated on June 27, 2022

Comments

  • Imperator123
    Imperator123 almost 2 years

    I wanted to install some libraries to learn machine learning. I say's that i need to upgrade pip, but when i tried to install it

    $ pip install --upgrade pip
    Collecting pip
      Using cached pip-9.0.1-py2.py3-none-any.whl
    Installing collected packages: pip
      Found existing installation: pip 8.1.2
        Uninstalling pip-8.1.2:
    Exception:
    Traceback (most recent call last):
      File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
        status = self.run(options, args)
      File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
        prefix=options.prefix_path,
      File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 736, in install
        requirement.uninstall(auto_confirm=True)
      File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
        paths_to_remove.remove(auto_confirm)
      File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
        renames(path, new_path)
      File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
        shutil.move(old, new)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 303, in move
        os.unlink(src)
    OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-8.1.2.dist-info/DESCRIPTION.rst'
    You are using pip version 8.1.2, however version 9.0.1 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    
  • Tranbi
    Tranbi almost 3 years
    This exact answer has been given by @Rustam A. over one year ago: stackoverflow.com/a/61162170/13525512