Description
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 is HKEY_CLASSES_ROOT\.gdoc
. Not sure why pip is enumerating all the entries in HKEY_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
- Use regedit to modifying the permissions of any key in
HKEY_CLASSES_ROOT
by marking the Administrators group with Deny permission for Full Control and Read. - Try to install any package using pip.
Output
ERROR: Could not install packages due to an OSError.
Check the permissions.
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\site-packages\pip\_internal\commands\install.py", line 377, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 179, in resolve
self.factory.preparer.prepare_linked_requirements_more(reqs)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\site-packages\pip\_internal\operations\prepare.py", line 552, in prepare_linked_requirements_more
self._complete_partial_requirements(
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\site-packages\pip\_internal\operations\prepare.py", line 487, in _complete_partial_requirements
self._prepare_linked_requirement(req, parallel_builds)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\site-packages\pip\_internal\operations\prepare.py", line 613, in _prepare_linked_requirement
local_file = File(file_path, content_type=None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\site-packages\pip\_internal\operations\prepare.py", line 87, in __init__
self.content_type = mimetypes.guess_type(path)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\mimetypes.py", line 309, in guess_type
init()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\mimetypes.py", line 371, in init
db.read_windows_registry()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\mimetypes.py", line 256, in read_windows_registry
_mimetypes_read_windows_registry(add_type)
PermissionError: [WinError 5] Access is denied
Remote version of pip: 24.0
Local version of pip: 24.0
Was pip installed by pip? True
Code of Conduct
- I agree to follow the PSF Code of Conduct.