2

I wanted to upgrade pip for installing libraries to learn machine learning. But i am unable to do so.

C:\Users\adith>pip install --upgrade pip
Collecting pip
  Downloading pip-21.0.1-py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 211 kB/s
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.3
    Uninstalling pip-20.2.3:
      Successfully uninstalled pip-20.2.3
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\Users\\adith\\AppData\\Local\\Temp\\pip-uninstall-40mydp3z\\pip.exe'
Consider using the `--user` option or check the permissions.

I am getting the above error. Any help would be very much appreciated. Thanks!

  • https://stackoverflow.com/search?q=%5Bpip%5D+ERROR%3A+Could+not+install+packages+due+to+an+EnvironmentError%3A+WinError+5+Access+is+denied – phd Mar 03 '21 at 12:25

1 Answers1

3

There are two ways to go about this:

* (Recommended way) is to just append the --user flag to the command you are trying to run, so you would run pip install --upgrade pip --user

or

* open cmd as an administrator and run that command

..................................................................................................................................

The reason this happened is because the folder you are trying to install pip is a folder that requires admin privileges to access.

Next time you should pay attention to what the error message says.
Most of the time the error message is self explanitory and there is no need to post a new question on S.O.
Arjix
  • 146
  • 9