Skip to content

Keyring prevent some package uninstall #8443

@pierreluctg

Description

@pierreluctg

Environment

  • pip version: 20.1.1
  • Python version: 3.7
  • OS: Windows

Description

Optional pip keyring support is cause some resource lock while uninstalling cffi

Expected behavior

pip should not lock any resources and allow clean uninstall of cffi

How to Reproduce

# Install keyring to enable keyring feature in pip
pip install keyring -q
# install cffi
pip install cffi -q
# uninstall cffi
pip uninstall cffi -y

Output

Found existing installation: cffi 1.14.0
Uninstalling cffi-1.14.0:
  Successfully uninstalled cffi-1.14.0
ERROR: Exception:
Traceback (most recent call last):
  File "c:\projects\.venv_pip_keyring\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in _main
    status = self.run(options, args)
  File "c:\projects\.venv_pip_keyring\lib\site-packages\pip\_internal\commands\uninstall.py", line 89, in run
    uninstall_pathset.commit()
  File "c:\projects\.venv_pip_keyring\lib\site-packages\pip\_internal\req\req_uninstall.py", line 450, in commit
    self._moved_paths.commit()
  File "c:\projects\.venv_pip_keyring\lib\site-packages\pip\_internal\req\req_uninstall.py", line 290, in commit
    save_dir.cleanup()
  File "c:\projects\.venv_pip_keyring\lib\site-packages\pip\_internal\utils\temp_dir.py", line 196, in cleanup
    rmtree(self._path)
  File "c:\projects\.venv_pip_keyring\lib\site-packages\pip\_vendor\retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "c:\projects\.venv_pip_keyring\lib\site-packages\pip\_vendor\retrying.py", line 212, in call
    raise attempt.get()
  File "c:\projects\.venv_pip_keyring\lib\site-packages\pip\_vendor\retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "c:\projects\.venv_pip_keyring\lib\site-packages\pip\_vendor\six.py", line 703, in reraise
    raise value
  File "c:\projects\.venv_pip_keyring\lib\site-packages\pip\_vendor\retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "c:\projects\.venv_pip_keyring\lib\site-packages\pip\_internal\utils\misc.py", line 136, in rmtree
    onerror=rmtree_errorhandler)
  File "c:\python37-32\lib\shutil.py", line 516, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "c:\python37-32\lib\shutil.py", line 400, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "c:\python37-32\lib\shutil.py", line 398, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\*****\\AppData\\Local\\Temp\\pip-uninstall-l1br_4h0\\_cffi_backend.cp37-win32.pyd'

To show that pip keyring feature is in cause here, setting the keyring backend to null (set PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring) is preventing this issue.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions