Pip upgrade causing issues in 3.10

David Raymond David.Raymond at tomtom.com
Tue Jul 19 14:43:52 EDT 2022


So after a long while I'm finally getting around to upgrading to 3.10 on Windows from 3.9, and my first pip upgrade is causing issues with the installation.

Problem seems to be that I run pip from a command prompt in the Scripts folder, and it seems pip is trying to completely remove the Scripts folder, which it can't because the command prompt is in that folder. It successfully removes the old installation of pip before dying, leaving you without a pip to run. (Yay for ensurepip) It also creates a ~ripts folder in the main Python folder, and a few ~ip folders in the site-packages folder before it dies, which then cause warnings to be issued by pip from then on (or at least until you go and delete those folders)

Upgrading pip this way worked fine in 3.9.x, so I'm curious as to why the change for 3.10? And is there a chance to go back to it not trying to completely remove that Scripts folder? Or at least have it fail a little more gracefully without creating all those ~ folders? Maybe add a hint about ensurepip when it removes the old and can't install the new?

For those who will say just change how you update it: I can do that going forward, yes.
But nonetheless, running it like this probably shouldn't leave me without a pip, and with extra junk folders.



Fresh install here of 3.10.5. For all users, not including the py launcher thing. Below is running in an Admin Command Prompt.


C:\Program Files\Python310\Scripts>pip list
Package    Version
---------- -------
pip        22.0.4
setuptools 58.1.0
WARNING: You are using pip version 22.0.4; however, version 22.1.2 is available.
You should consider upgrading via the 'C:\Program Files\Python310\python.exe -m pip install --upgrade pip' command.

C:\Program Files\Python310\Scripts>..\python.exe -m pip install --upgrade pip
Requirement already satisfied: pip in c:\program files\python310\lib\site-packages (22.0.4)
Collecting pip
  Using cached pip-22.1.2-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.0.4
    Uninstalling pip-22.0.4:
ERROR: Could not install packages due to an OSError: [WinError 32] The process cannot access the file because it is being used by another process: 'c:\\program files\\python310\\scripts\\'
Consider using the `--user` option or check the permissions.


At this point the Scripts folder is completely empty, there's a ~ripts folder in the main python310 folder, and a few ~ip... folders in the site-packages folder


C:\Program Files\Python310\Scripts>..\python.exe -m ensurepip
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
Looking in links: c:\Users\usernamehere\AppData\Local\Temp\tmpt48ibdf3
Requirement already satisfied: setuptools in c:\program files\python310\lib\site-packages (58.1.0)
Processing c:\users\usernamehere\appdata\local\temp\tmpt48ibdf3\pip-22.0.4-py3-none-any.whl
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
Installing collected packages: pip
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
Successfully installed pip-22.0.4

C:\Program Files\Python310\Scripts>cd..

C:\Program Files\Python310>python.exe -m pip install -U pip
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
Requirement already satisfied: pip in c:\program files\python310\lib\site-packages (22.0.4)
Collecting pip
  Using cached pip-22.1.2-py3-none-any.whl (2.1 MB)
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
Installing collected packages: pip
  Attempting uninstall: pip
    WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
    Found existing installation: pip 22.0.4
    Uninstalling pip-22.0.4:
      Successfully uninstalled pip-22.0.4
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
Successfully installed pip-22.1.2
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)

C:\Program Files\Python310>cd Scripts

C:\Program Files\Python310\Scripts>pip list
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
Package    Version
---------- -------
pip        22.1.2
setuptools 58.1.0
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\program files\python310\lib\site-packages)


More information about the Python-list mailing list