Skip to content

In Windows, pip wouldn't delete read-only file(when install via git) #1744

@robberphex

Description

@robberphex

I put a package in github, and install by command pip install git+https://github.com/RobberPhex/mysql-connector-python
I got a error:

Cleaning up...
  Exception:
Traceback (most recent call last):
  File "C:\Python34\lib\shutil.py", line 370, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\ROBBER~1\\AppData\\Local\\Temp\\pip-9hyythjm-build\\.git\\objects\\pack\\pack-cfbcf285d8e9cfd47348c04e497acb0e554e55e3.idx'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\pip\commands\install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "C:\Python34\lib\site-packages\pip\req.py", line 1444, in install
    requirement.remove_temporary_source()
  File "C:\Python34\lib\site-packages\pip\req.py", line 761, in remove_temporary_source
    rmtree(self._temp_build_dir)
  File "C:\Python34\lib\site-packages\pip\util.py", line 43, in rmtree
    onerror=rmtree_errorhandler)
  File "C:\Python34\lib\shutil.py", line 477, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\Python34\lib\shutil.py", line 367, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Python34\lib\shutil.py", line 367, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Python34\lib\shutil.py", line 367, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Python34\lib\shutil.py", line 372, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Python34\lib\site-packages\pip\util.py", line 53, in rmtree_errorhandler
    (exctype is PermissionError and value.args[3] == 5) #python3.3
IndexError: tuple index out of range

It is because pip wouldn't delete read-only file in Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-lockedOutdated issues that have been locked by automation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions