pip asked me to upgrade with a message:
You are using pip version 7.0.1, however version 7.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
So I ran that command and I get an exception that pip cannot uninstall the old version because access to my user directory is denied:
Collecting pip Downloading pip-7.0.3-py2.py3-none-any.whl (1.1MB) 100% |################################| 1.1MB 292kB/s Installing collected packages: pip Found existing installation: pip 7.0.1 Uninstalling pip-7.0.1: Successfully uninstalled pip-7.0.1 Exception: Traceback (most recent call last): File "C:\Python27\lib\site-packages\pip\basecommand.py", line 223, in main status = self.run(options, args) File "C:\Python27\lib\site-packages\pip\commands\install.py", line 297, in run root=options.root_path, File "C:\Python27\lib\site-packages\pip\req\req_set.py", line 633, in install requirement.commit_uninstall() File "C:\Python27\lib\site-packages\pip\req\req_install.py", line 734, in commit_uninstall self.uninstalled.commit() File "C:\Python27\lib\site-packages\pip\req\req_uninstall.py", line 153, in commit rmtree(self.save_dir) File "C:\Python27\lib\site-packages\pip\_vendor\retrying.py", line 49, in wrapped_f return Retrying(*dargs, **dkw).call(f, *args, **kw) File "C:\Python27\lib\site-packages\pip\_vendor\retrying.py", line 212, in call raise attempt.get() File "C:\Python27\lib\site-packages\pip\_vendor\retrying.py", line 247, in get six.reraise(self.value[0], self.value[1], self.value[2]) File "C:\Python27\lib\site-packages\pip\_vendor\retrying.py", line 200, in call attempt = Attempt(fn(*args, **kwargs), attempt_number, False) File "C:\Python27\lib\site-packages\pip\utils\__init__.py", line 89, in rmtree onerror=rmtree_errorhandler) File "C:\Python27\lib\shutil.py", line 247, in rmtree rmtree(fullname, ignore_errors, onerror) File "C:\Python27\lib\shutil.py", line 247, in rmtree rmtree(fullname, ignore_errors, onerror) File "C:\Python27\lib\shutil.py", line 252, in rmtree onerror(os.remove, fullname, sys.exc_info()) File "C:\Python27\lib\site-packages\pip\utils\__init__.py", line 101, in rmtree_errorhandler func(path) WindowsError: [Error 5] Access is denied: 'c:\\users\\chris\\appdata\\local\\temp\\pip-ossyhh-uninstall\\python27\\scripts\\pip.exe'
I'm running Windows 8.1, but I've had this same Error on another machine running Windows 7. It doesn't seem to stop the installation of the new version, but I do end up with pip folders left in my temp directory. Does anyone know why this happens or how I can correct it?
Edit1: Oddly, running the upgrade with admin privlidges throws a new exception:
File "C:\Python27\lib\site-packages\pip-7.0.1-py2.7.egg\pip\_vendor\distlib\scripts.py", line 302, in _get_launcher
result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'`
And fails the upgrade entirely.
Edit2: The only way to get around this issue does seem to be using easy_install to upgrade pip (either the -U or -m options), but it seems like a problem to me if pip can't upgrade itself, when its intended (and stated) functionality is to do so.
The problem here is apparently because you are running
pip.exe
to upgrade itself. So thepip.exe
to be deleted is actually running at the time. The fix is to use a slightly different command line:This is from this bug report (though there are others):