0

I am trying to upgrading pip from 8.1.1 to 8.1.2 . But it showing following 'PermissionError: [WinError 5] Access is denied: How to upgrade pip?

C:\>python -m pip install --upgrade pip
Collecting pip
  Using cached pip-8.1.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 8.1.1
    Uninstalling pip-8.1.1:
Exception:
Traceback (most recent call last):
  File "C:\Program Files\Python35\lib\shutil.py", line 538, in move
    os.rename(src, real_dst)
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python35\\lib\\site-packages\\pip-8.1.1.dist-info\\description.rst' -> 'C:\\Users\\user\\AppD
ata\\Local\\Temp\\pip-nen4ldwg-uninstall\\program files\\python35\\lib\\site-packages\\pip-8.1.1.dist-info\\description.rst'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python35\lib\site-packages\pip\basecommand.py", line 209, in main
    status = self.run(options, args)
  File "C:\Program Files\Python35\lib\site-packages\pip\commands\install.py", line 317, in run
    prefix=options.prefix_path,
  File "C:\Program Files\Python35\lib\site-packages\pip\req\req_set.py", line 726, in install
    requirement.uninstall(auto_confirm=True)
  File "C:\Program Files\Python35\lib\site-packages\pip\req\req_install.py", line 746, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "C:\Program Files\Python35\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "C:\Program Files\Python35\lib\site-packages\pip\utils\__init__.py", line 267, in renames
    shutil.move(old, new)
  File "C:\Program Files\Python35\lib\shutil.py", line 553, in move
    os.unlink(src)
PermissionError: [WinError 5] Access is denied: 'c:\\program files\\python35\\lib\\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 'python -m pip install --upgrade pip' command.

This problem occurs even with administrator privileges.

strpeter
  • 2,562
  • 3
  • 27
  • 48
  • Possible duplicate of [Python - PIP install trouble shooting - PermissionError: \[WinError 5\] Access is denied](http://stackoverflow.com/questions/32167418/python-pip-install-trouble-shooting-permissionerror-winerror-5-access-is) – strpeter Jan 25 '17 at 15:39

2 Answers2

0

open your cmd with admin priviliges. for that right click in icon and select open with administrator.

armak
  • 560
  • 5
  • 13
0

Upgrade PIP on your default python environment required sudo, i.e. in Windows term, you must your start command prompt as administrator mode. In fact, this is not recommended.

You don't need to use sudo/'Windows adminsitrators" if you setup virtualenv. It is python best practice to setup Python virtualenv , So you can separate the pip package required for individual project. For windows, it is similar setup.

Nevertheless, if you have decent PC with enough RAM, just install Virtualbox and deploy ubuntu. This way, your don't need to deal with windows python package installation/upgrade that overlook by developer (although all python package suppose to work out of the box) .

mootmoot
  • 12,845
  • 5
  • 47
  • 44