pip broke after downlading python-certifi-win32
Asked Answered
G

2

9

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'
Gobetween answered 17/5, 2022 at 21:17 Comment(0)
G
12

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

Gobetween answered 18/5, 2022 at 17:25 Comment(2)
The package python-certifi-win32 is a nightmare! But the above reply can disable it and bring pip and conda back to life!Mercie
Amazing! I've been banging my head against unhelpful Google results for ages today, and this answer got pip working again for me :)Tillery
C
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.

Cat answered 16/6, 2022 at 17:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.