Title: pip upgrade runtime crash
Type: crash Stage: resolved
Components: Windows Versions: Python 3.6
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:
Traceback (most recent call last):
  File "e:\programs\python36-32\lib\", 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\", line 215, in main
  File "e:\programs\python36-32\lib\site-packages\pip\commands\", line 342, in run
  File "e:\programs\python36-32\lib\site-packages\pip\req\", line 778, in install
  File "e:\programs\python36-32\lib\site-packages\pip\req\", line 754, in uninstall
  File "e:\programs\python36-32\lib\site-packages\pip\req\", line 115, in remove
  File "e:\programs\python36-32\lib\site-packages\pip\utils\", line 267, in renames
  File "e:\programs\python36-32\lib\", line 559, in move
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\", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "e:\programs\python36-32\lib\", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Programs\Python36-32\Scripts\pip.exe\", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

I sent an email 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 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".
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