New submission from Zombo <srp...@gmail.com>:

I can install a package:

    pip install brotli

but if I try to remove, it fails:

    PS D:\Desktop> pip uninstall -y brotli
    Found existing installation: Brotli 1.0.9
    Uninstalling Brotli-1.0.9:
      Successfully uninstalled Brotli-1.0.9
    ERROR: Exception:
    Traceback (most recent call last):
      File "C:\python\lib\site-packages\pip\_internal\cli\base_command.py", 
line 167, in exc_logging_wrapper
        status = run_func(*args)
      File "C:\python\lib\site-packages\pip\_internal\commands\uninstall.py", 
line 102, in run
        uninstall_pathset.commit()
      File "C:\python\lib\site-packages\pip\_internal\req\req_uninstall.py", 
line 420, in commit
        self._moved_paths.commit()
      File "C:\python\lib\site-packages\pip\_internal\req\req_uninstall.py", 
line 273, in commit
        save_dir.cleanup()
      File "C:\python\lib\site-packages\pip\_internal\utils\temp_dir.py", line 
173, in cleanup
        rmtree(self._path)
      File "C:\python\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 
326, in wrapped_f
        return self(f, *args, **kw)
      File "C:\python\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 
406, in __call__
        do = self.iter(retry_state=retry_state)
      File "C:\python\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 
362, in iter
        raise retry_exc.reraise()
      File "C:\python\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 
195, in reraise
        raise self.last_attempt.result()
      File "concurrent\futures\_base.py", line 439, in result
      File "concurrent\futures\_base.py", line 391, in __get_result
      File "C:\python\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 
409, in __call__
        result = fn(*args, **kwargs)
      File "C:\python\lib\site-packages\pip\_internal\utils\misc.py", line 124, 
in rmtree
        shutil.rmtree(dir, ignore_errors=ignore_errors, 
onerror=rmtree_errorhandler)
      File "shutil.py", line 747, in rmtree
      File "shutil.py", line 617, in _rmtree_unsafe
      File "shutil.py", line 615, in _rmtree_unsafe
    PermissionError: [WinError 5] Access is denied: 
'C:\\Windows\\Temp\\pip-uninstall-fi5xmcvd\\_brotli.cp310-win_amd64.pyd'

whats strange is that after the failure, I can go back and manually remove the 
folder with no problem:

    PS D:\Desktop> python.exe
    Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 
bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import shutil
    >>> shutil.rmtree('C:\\Windows\\Temp\\pip-uninstall-fi5xmcvd')

----------
messages: 415965
nosy: 89z
priority: normal
severity: normal
status: open
title: PermissionError on pip uninstall
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue47113>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to