Windows 10 and pip update - access denied

I did a fresh install of Windows 10, installed python, cygwin and the improved ConEmu console. After installing python 3.4.3, I do:

pip install -U pip 

And got this error.

 File "C:\Anwendungsentwicklung\Python34\lib\site-packages\pip\utils\__init__.py", line 70, in rmtree_errorhandler os.makedirs(path) PermissionError: [WinError 5] Zugriff verweigert: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-dxm8d3xg-uninstall\\anwendungsentwicklung\\python34\\scripts\\pip.exe' 

I logged in with a predefined administrator account, and the temporary directory as well as the Python installation directory (C: \ Anwendungsentwicklung \ Python34) have full access.

Please, I checked all the options by setting different rights, but Windows will not allow me. I even added “Everything” to the security tab, but it didn’t help, although I remember that he worked with Windows 7 with this “trick”. This should be a problem with Windows 10. Can someone help?

enter image description here


This is a complete trace.

  Exception: Traceback (most recent call last): File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 372, in _rmtree_unsafe os.unlink(fullname) PermissionError: [WinError 5] Zugriff verweigert: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-k7g0hd6t- uninstall\\anwendungsentwicklung\\python34\\scripts\\pip.exe' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\basecommand.py", line 232, in main logger.critical('Operation cancelled by user') File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\commands\install.py", line 347, in run ensure_dir(options.target_dir) File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\req\req_set.py", line 560, in install missing_requested = sorted( File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\req\req_install.py", line 677, in commit_uninstall logger.debug( File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\req\req_uninstall.py", line 153, in commit self.save_dir = None File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\utils\__init__.py", line 58, in rmtree SUPPORTED_EXTENSIONS = ZIP_EXTENSIONS + TAR_EXTENSIONS File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 484, in rmtree return _rmtree_unsafe(path, onerror) File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 368, in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 368, in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 368, in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 376, in _rmtree_unsafe print(fullname) File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\utils\__init__.py", line 70, in rmtree_errorhandler try: PermissionError: [WinError 5] Zugriff verweigert: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-k7g0hd6t-uninstall\\anwendungsentwicklung\\python34\\scripts\\pip.exe' 

Now I have added a breakpoint in "c: \ anwendungsentwicklung \ python34 \ lib \ shutil.py":

 # version vulnerable to race conditions def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: #import pdb os.unlink(fullname) #pdb.set_trace() except OSError: import pdb; pdb.set_trace() print(fullname) import getpass print(getpass.getuser()) onerror(os.unlink, fullname, sys.exc_info()) try: os.rmdir(path) except OSError: onerror(os.rmdir, path, sys.exc_info()) 

When i do

 os.unlink(fullname) # 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-k7g0hd6t- uninstall\\anwendungsentwicklung\\python34\\scripts\\pip.exe' 

I get this PermissionError , so I checked the rights of this .exe file to

 oct(os.stat(fullname)[ST_MODE]) 

and it returns: '0o100777'

And when I'm right, it means full permission for everyone (owner, group and others).

I'm upset: / Does anyone have an idea?

+5
source share
2 answers

As discussed here , this is a limitation of Windows. In short, the pip.exe file is used and thus locked and cannot be deleted. Use python -m pip install --upgrade pip .

+4
source

My first choice in the same situation is to run the console with administrator privileges. You can do this from the Start menu, or if you use ConEmu / Cmder, just start a new instance / tab as an administrator.

+4
source

All Articles