//
you're reading...
Programming, Technical, Windows

Fix “[Error 5] Access is denied” when upgrading pip on windows

When using pip to install a python package from a Windows command window, pip displayed the following message

You are using pip version 7.0.1, however version 8.1.2 is available.
You should consider upgrading via the ‘pip install –upgrade pip’ command.

However, when I ran that command, pip displayed the following error

WindowsError: [Error 5] Access is denied: ‘c:\\users\\julie\\appdata\\local\\temp\\pip-w6u9yc-uninstall\\programs\\python27\\scripts\\pip.exe’

The solution (thanks to an answer on Stack Overflow) is to use the following command

python -m pip install –force-reinstall –upgrade pip

Explanation

From the Stack Overflow answer: “On Windows you can’t replace in-use executables”

  • The error is caused because pip.exe cannot replace itself whilst it is running
  • By running pip from python, the pip.exe executable is not running, so pip.exe can be replaced with the new version

 

Advertisements

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: