Open Enchiridion opened 3 months ago
We can add a internal utility function which wraps mimetypes.guess_type
and returns (None, None)
on an OSError, although care needs to be taken that pip degrades gracefully when the mimetype fails to be deduced.
Ensure you are using the latest version of pip. Sometimes, updating pip can resolve unexpected issues:
Use the below command
python -m pip install --upgrade pip
Since the issue is caused by restricted registry keys, you might need to temporarily restore access to these keys:
Open the Registry Editor (regedit).
1.Navigate to the problematic keys, such as HKEY_CLASSES_ROOT.gdoc. 2.Right-click on the key, select "Permissions," and restore your access. 3.Run the pip install command again. 4.Revoke the permissions again after the installation is complete.
@georgepr0xy This was on a fresh install of Python 3. I tried to update pip, but due to pip quitting on the first registry error, it was unable to update itself.
Temporarily changing the reg key permissions is what I did to get around the issue for now.
Since pip is failing due to registry errors, manually updating pip might help:
You might consider modifying the pip source code temporarily to skip over registry keys it can't access. This is a bit more advanced and involves editing the pip package files:
Locate pip installation: Find where pip is installed. It is typically located in Lib\site-packages\pip within your Python directory.
Modify the code: Identify the part of the code where pip might be accessing the registry (this might be a bit complex as pip does not typically interact with the registry directly). Insert try-except blocks to catch and ignore permission errors.
@georgepr0xy Are you copying and pasting AI responses? If so, I ask that it stops as it simply serves to add noise to this issue, failing to provide a proper solution to this issue.
Modify the permissions of the problematic registry keys to grant read access temporarily, install the package, and then revert the permissions. Alternatively, run the pip installation with elevated privileges using an Administrator command prompt.
You can first navigate to the directory by opening the terminal/commandprompt using admin account[run as administrator] and then go and try that again the same error i encountered and did this (it worked )
Description
When installing a package using pip, it fails with the error:
PermissionError: [WinError 5] Access is denied
. I used Process Monitor to trace the error to a registry key it couldn't access. Instead of pip skipping the inaccessible key and continuing the installation, it failed. It was failing over 3 registry keys I had earlier removed my own access to to prevent Google Drive from constantly recreating new ShellNew entries (a known and very annoying issue with GD), one of them isHKEY_CLASSES_ROOT\.gdoc
. Not sure why pip is enumerating all the entries inHKEY_CLASSES_ROOT
but I think it should skip any it can't access.Expected behavior
For the install to successfully complete. If pip can't access a registry key in
HKEY_CLASSES_ROOT
it should skip and continue.pip version
24.0
Python version
3.12.4
OS
Windows 11
How to Reproduce
HKEY_CLASSES_ROOT
by marking the Administrators group with Deny permission for Full Control and Read.Output
Code of Conduct