This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author 89z
Recipients 89z
Date 2022-03-24.18:27:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648146449.62.0.573957246169.issue47113@roundup.psfhosted.org>
In-reply-to
Content
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')
History
Date User Action Args
2022-03-24 18:27:2989zsetrecipients: + 89z
2022-03-24 18:27:2989zsetmessageid: <1648146449.62.0.573957246169.issue47113@roundup.psfhosted.org>
2022-03-24 18:27:2989zlinkissue47113 messages
2022-03-24 18:27:2989zcreate