Python - PIP install trouble shooting - PermissionError: [WinError 5] Access is denied Python - PIP install trouble shooting - PermissionError: [WinError 5] Access is denied windows windows

Python - PIP install trouble shooting - PermissionError: [WinError 5] Access is denied


E: Since this answer seems to have gained some popularity, I will add: doing things globally is most of the time not a great idea. Almost always the correct answer is: use a project environment where you're not installing things globally, e.g. with virtualenv.


For those that may run into the same issue:

Run the command prompt as administrator. Having administrator permissions in the account is not always enough. In Windows, things can be run as administrator by right-clicking the executable and selecting "Run as Administrator". So, type "cmd" to the Start menu, right click cmd.exe, and run it as administrator.


I know my answer would be weird but that's what I have experienced just now.

I got the similar error when installing tensorflow package and I tried the same by opening powershell in windows as administrator but in vain.

Later I found out that I was already using numpy in one of the python scripts in an active python session. So I closed the Spyder IDE and tried to install the tensorflow package by running powershell as administrator and it worked.

Hope this will help somebody else like me who will open this older but useful post in upcoming days


Even you run from Administrator, it may not solve the issue if the pip is installed inside another userspace. This is because Administrator doesn't own another's userspace directory, thus he can't see (go inside) the inside of the directory that is owned by somebody. Below is an exact solution.

python -m pip install -U pip --user //In Windows 

Note: You should provide --user optioninstead use python -m pip install --upgrade pip --user in windows.

pip install -U pip --user //Linux, and MacOS