Description
Description
When I upgrade pip using a freshly installed Python 3.9.7 environment in a command prompt from the Scripts folder, the upgrade fails, the Scripts folder is emptied and the pip module is removed as well.
Below you will find "Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird". This translates to "The process cannot access the file, since it is used by another process".
I am used to do all upgrades of pip modules from within the Scripts folder. Because of this I use "..\python.exe" to run Python from there.
When I execute "python.exe -m pip install -U pip" from the Python39 folder, then the upgrade succeeds on a fresh Python installation. So it points to as if pip tries to delete the Scripts folder and then rename the ~cripts folder that it has created during the install process. Why does pip not copy the contents of ~cripts to the emptied folder Scripts? Such my kind of upgrading pip would work as it used to work earlier.
Expected behavior
A normal upgrade of pip from version 21.2.3 to 21.2.4 (or whatever is the most recent version).
pip version
21.2.3
Python version
3.9.7
OS
Windows 10
How to Reproduce
- Get python-3.9.7-amd64.exe from https://www.python.org/downloads/
- Install it in "D:\Programme\Python\Python39".
- Open a command prompt, e. g. Windows command prompt or ConEmu (x64) (I use the latter).
- Navigate to folder "D:\Programme\Python\Python39\Scripts".
- Execute "..\python.exe -m pip install -U pip".
Output
Microsoft Windows [Version 10.0.19043.1237]
<UserAccountName>@<DeviceName> D:\Programme\Python\Python39\Scripts
$ pip list --outdated
Package Version Latest Type
---------- ------- ------ -----
pip 21.2.3 21.2.4 wheel
setuptools 57.4.0 58.1.0 wheel
WARNING: You are using pip version 21.2.3; however, version 21.2.4 is available.
You should consider upgrading via the 'D:\Programme\Python\Python39\python.exe -m pip install --upgrade pip' command.
<UserAccountName>@<DeviceName> D:\Programme\Python\Python39\Scripts
$ ..\python.exe -m pip install -U pip
Requirement already satisfied: pip in d:\programme\python\python39\lib\site-packages (21.2.3)
Collecting pip
Downloading pip-21.2.4-py3-none-any.whl (1.6 MB)
|████████████████████████████████| 1.6 MB 2.2 MB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.2.3
Uninstalling pip-21.2.3:
ERROR: Could not install packages due to an OSError: [WinError 32] Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird: 'd:\\programme\\python\\python39\\scripts\\'
Consider using the `--user` option or check the permissions.
<UserAccountName>@<DeviceName> D:\Programme\Python\Python39\Scripts
$ ..\python.exe -m pip install -U pip
D:\Programme\Python\Python39\python.exe: No module named pip
Code of Conduct
- I agree to follow the PSF Code of Conduct.