Search code examples
pythonpip

pip broke after downlading python-certifi-win32


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'

Solution

  • 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 :)