I get the following error when using PIP to either install new packages or even upgrade pip itself to the latest version. I am running pip on a windows 8.1 machine with Python 3.4.
The message is telling me I don't have Administrative Permission on the files (my account is an Administrator Account).
I would appreciate any thoughts on how to resolve this, as it is getting in the way of installing packages and progressing with Python.
Error message:
Installing collected packages: pip Found existing installation: pip 6.0.8 Uninstalling pip-6.0.8: Removing file or directory c:\program files (x86)\python\python34\lib\site-packages\pip-6.0.8.dist-info\description.rst Cleaning up... Exception: Traceback (most recent call last): File "C:\Program Files (x86)\Python\Python34\lib\shutil.py", line 523, in move os.rename(src, real_dst) PermissionError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python\\python34\\lib\\site-packages\\pip-6.0.8.dist-info\\description.rst' -> 'C:\\Users\\User\\AppData\\Local\\Temp\\pip-uze_sc4k-uninstall\\program files (x86)\\python\\python34\\lib\\site-packages\\pip-6.0.8.dist-info\\description.rst' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Program Files (x86)\Python\Python34\lib\site-packages\pip\basecommand.py", line 232, in main status = self.run(options, args) File "C:\Program Files (x86)\Python\Python34\lib\site-packages\pip\commands\install.py", line 347, in run root=options.root_path, File "C:\Program Files (x86)\Python\Python34\lib\site-packages\pip\req\req_set.py", line 543, in install requirement.uninstall(auto_confirm=True) File "C:\Program Files (x86)\Python\Python34\lib\site-packages\pip\req\req_install.py", line 667, in uninstall paths_to_remove.remove(auto_confirm) File "C:\Program Files (x86)\Python\Python34\lib\site-packages\pip\req\req_uninstall.py", line 126, in remove renames(path, new_path) File "C:\Program Files (x86)\Python\Python34\lib\site-packages\pip\utils\__init__.py", line 316, in renames shutil.move(old, new) File "C:\Program Files (x86)\Python\Python34\lib\shutil.py", line 536, in move os.unlink(src) PermissionError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python\\python34\\lib\\site-packages\\pip-6.0.8.dist-info\\description.rst'
Ensure you can run pip from the command lineRun python get-pip.py . 2 This will install or upgrade pip. Additionally, it will install setuptools and wheel if they're not installed already. Be cautious if you're using a Python install that's managed by your operating system or another package manager.
To install Python packages (“eggs”) from the Python language's package manager pip, follow our instructions below. This can be done without Administrator access in a per-user, per-project clean manner with virtualenv.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With