'Access is denied when trying to pip install a package on Windows
How to set path for python 3.7.0? I tried the every possible way but it still shows the error!
Could not install packages due to an EnvironmentError: [WinError 5]
Access is denied: 'c:\program files (x86)\python37-32\lib\site-packages\pip-10.0.1.dist-info\entry_points.txt'
Consider using the
--useroption or check the permissions
Solution 1:[1]
Add --user to the command.
eg:
pip install -r requirements.txt --user
Solution 2:[2]
Append the --user modifier to your command as suggested in the error.
--usermakes pip install packages in your home directory instead, which doesn't require any special privileges.
Solution 3:[3]
Run your command Prompt on Admin-Mode in Windows,it will stop throwing errors for user-rights.
Steps:
On Windows, type "Cmd" on searchbox to search for command prompt.
When "Command Prompt" search result appears,right-click>Run as Administrator.
Solution 4:[4]
You can add --user in the end of your command. This works well in my case!
--user
My example:
python -m pip install --upgrade pip --user
Solution 5:[5]
Just try on Administrator cmd
pip install --user numpy
Solution 6:[6]
Run your command prompt on admin mode. type :
cd\
then type:
cd [Your python location path]
on mycomputer it's:
cd C:\Users\hp\AppData\Local\Programs\Python\Python37-32
then type:
python -m pip install --upgrade pip
You can follow this guide~ https://datatofish.com/upgrade-pip/
Solution 7:[7]
I had the same problem.
After installing Python for all the users, wanted to install Django.
For that I've gone to the Command Prompt (without using Admin mode) and
pip.exe install django==2.2
This prompted the following message
Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\program files\python37\lib\site-packages\pip-19.0.3.dist-info\entry_points.txt' Consider using the
--useroption or check the permissions.
The way I've used to solve it was to add --user in the end of the command, just like the prompt message suggests («Consider using the --user»).
pip.exe install django==2.2 --user
Then everything worked fine.
Solution 8:[8]
The question was for windows but if any linux users that stumbled here (like me) : Permission Error Persists by adding --user in my virtualenv on Ubuntu 19 when I want to generate requirements.txt. Also, I can't pip install --user as well since I'm in an virtualenv. My solution was just using sudo pip3 install pipreqs to install another pipreqs for super user.
Solution 9:[9]
I wanted to throw an answer out here because I've been against a rock wall since upgrading to python 3.18. Pip install stopped working with a module error which was rectified with py -m pip install --user. but I would still get this permissions error. I uninstalled, reinstalled, and downgraded Python and Pip. I ran command prompt as administrator. None of it worked.
The only thing that worked was to pip download and then pip install the package from my c:/ drive. Totally BS workaround, but if you'r as stuck as I was it works.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
