classification
Title: pip upgrade runtime crash
Type: crash Stage: resolved
Components: Windows Versions: Python 3.6
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: bramnet, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2018-04-15 21:47 by bramnet, last changed 2018-04-16 08:01 by paul.moore. This issue is now closed.

Messages (2)
msg315344 - (view) Author: Bram Borger-Johnson (bramnet) Date: 2018-04-15 21:47
I was using pip to install a package when I got a warning message that a new version of pip was available.
I ran the prompted command and got the following back.
E:\GitHub\discord_feedbot>pip install --upgrade pip
Collecting pip
  Downloading pip-10.0.0-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 654kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
Exception:
Traceback (most recent call last):
  File "e:\programs\python36-32\lib\shutil.py", line 544, in move
    os.rename(src, real_dst)
OSError: [WinError 17] The system cannot move the file to a different disk drive: 'e:\\programs\\python36-32\\scripts\\pip.exe' -> 'C:\\Users\\Bram\\AppData\\Local\\Temp\\pip-nahcxphl-uninstall\\programs\\python36-32\\scripts\\pip.exe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "e:\programs\python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
  File "e:\programs\python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
  File "e:\programs\python36-32\lib\site-packages\pip\req\req_set.py", line 778, in install
  File "e:\programs\python36-32\lib\site-packages\pip\req\req_install.py", line 754, in uninstall
  File "e:\programs\python36-32\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
  File "e:\programs\python36-32\lib\site-packages\pip\utils\__init__.py", line 267, in renames
  File "e:\programs\python36-32\lib\shutil.py", line 559, in move
    os.unlink(src)
PermissionError: [WinError 5] Access is denied: 'e:\\programs\\python36-32\\scripts\\pip.exe'

Now, whenever I run pip at all, it results in 
Traceback (most recent call last):
  File "e:\programs\python36-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "e:\programs\python36-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Programs\Python36-32\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

I sent an email help@python.org who directed me to create a bug report, stating that it looks like the people behind pip "didn't expect your temp directory to be on a different drive from your library directory."
msg315352 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2018-04-16 08:01
Issues with pip should be reported at https://github.com/pypa/pip/issues rather than here. However, in this case, the issue is that you ran the command "pip install --upgrade pip" which will use the pip executable to upgrade itself, something that Windows blocks. To upgrade pip you should run the command "python -m pip install --upgrade pip", using "python -m pip" rather than plain "pip".
History
Date User Action Args
2018-04-16 08:01:39paul.mooresetstatus: open -> closed
resolution: third party
messages: + msg315352

stage: resolved
2018-04-15 21:47:49bramnetcreate