7

I have downloaded python for the first time in a new computer(ver 3.10.4). I have download the package python-certifi-win32, after someone suggested it as a solution to a SSL certificate problem in a similar question to a problem I had. Since then, pip has completely stopped working, to the point where i can't not run pip --version Every time the same error is printed, it is mostly seemingly junk(just a deep stack trace), but the file at the end is different.

start of the printed log:

Traceback (most recent call last):
  File "C:\Users\---\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 89, in _tempfile
    os.write(fd, reader())
  File "C:\Users\---\AppData\Local\Programs\Python\Python310\lib\importlib\abc.py", line 371, in read_bytes
    with self.open('rb') as strm:
  File "C:\Users\---\AppData\Local\Programs\Python\Python310\lib\importlib\_adapters.py", line 54, in open
    raise ValueError()
ValueError

During handling of the above exception, another exception occurred:

last row of the printed log:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\-----\\AppData\\Local\\Temp\\tmpunox3fhw'
Asaf Tzubary
  • 179
  • 8

2 Answers2

7

I found the answer in another question - PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: after installing python-certifi-win32

basically, you should remove two files that initialize python-certifi-win32 when running pip. the files are located in the directory:

C:\Users\<username>\AppData\Local\Programs\Python\Python310\Lib\site-packages

and their names are:

python-certifi-win32-init.pth
distutils-precedence.pth

Shoutout to Richard from the mentioned post :)

Asaf Tzubary
  • 179
  • 8
  • The package python-certifi-win32 is a nightmare! But the above reply can disable it and bring pip and conda back to life! – Alex Byrth Aug 13 '23 at 21:05
4

While removing the offending .pth-files lead to a working pip again for me, the functionality of the python-certifi-win32 was lost with doing so.

Andrew Leech, the author of python-certifi-win32, suggests to move on to his other project pip-system-certs . Drop-in replacing the library with pip-system-certs (PyPI link) solved all issues for me that resulted with upgrading to Python 3.10.

Briareos386
  • 1,927
  • 18
  • 34