Imperator123
Imperator123

Reputation: 609

Unable to upgrade pip

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.

Upvotes: 5

Views: 14314

Answers (6)

NargesKarimi
NargesKarimi

Reputation: 16

I also could not update the pip and my problem was solved with proxy. in cmd:

netstat -a -n

then it gives a proxy list. Try some of them (ID:port):

pip install --proxy="https://ID:port" numpy

(numpy or any library)

It may give an error, but continue:

C:\...\python.exe -m pip install --upgrade pip

(C:..) is the path of Python.exe on your computer. this way updates the pip. This way was helpful for me. I hope it will be useful for others.

Upvotes: 0

pramod
pramod

Reputation: 1

ERROR: Could not find a version that satisfies the requirement upgrade (from versions: none) ERROR: No matching distribution found for upgrade

type this in cmd to upgrade:

python -m pip install -U pip

Upvotes: -1

Rustam A.
Rustam A.

Reputation: 879

Upgrading pip

On Linux or macOS:

pip install -U pip

On Windows:

python -m pip install -U pip

Source

Upvotes: 0

Positive Navid
Positive Navid

Reputation: 2781

Windows:

1) Close the current command prompt window.

2) Open it again, but as admin: right click and choose: "Run as administrator"

enter image description here

Linux or Unix:

Start the command with "sudo" as Tim and Haifeng mentiond.

Upvotes: 1

Haifeng Zhang
Haifeng Zhang

Reputation: 31895

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

Upvotes: 1

Tim Givois
Tim Givois

Reputation: 2014

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

Upvotes: 3

Related Questions