Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/pipPublic
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Ignore errors in temporary directory cleanup#11394

Merged
uranusjr merged 5 commits intopypa:mainfromales-erjavec:temp-cleanup-ignore-errors
Jul 27, 2023

Conversation

ales-erjavec
Copy link
Contributor

@ales-erjavecales-erjavec commentedAug 19, 2022
edited
Loading

Pip frequently fails on windows with a PermissionError in temporary directory cleanup after it has already successfully installed upgraded/uninstalled a package.

E.g if you haveimport matplotlib in one python session and run

> pip install matplotlib==3.4.3

in another, you get

...Installing collected packages: matplotlib  Attempting uninstall: matplotlib    Found existing installation: matplotlib 3.4.3    Uninstalling matplotlib-3.4.3:      Successfully uninstalled matplotlib-3.4.3ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Users\\ales\\.envs\\Lib\\site-packages\\~4tplotlib\\ft2font.cp39-win_amd64.pyd'Check the permissions.

(note the '\\~4tplotlib\\' name) indicating this is failure to remove an temp backup; a new package is already fully installed at this point)

With this applied

Installing collected packages: matplotlib  Attempting uninstall: matplotlib    Found existing installation: matplotlib 3.4.2    Uninstalling matplotlib-3.4.2:      Successfully uninstalled matplotlib-3.4.2  WARNING: Failed to remove a temporary file 'C:\Users\ales\.envs\Lib\site-packages\~-tplotlib\ft2font.cp39-win_amd64.pyd' due to PermissionError: [WinError 5] Access is denied: 'C:\\Users\\ales\\.envs\\Lib\\site-packages\\~-tplotlib\\ft2font.cp39-win_amd64.pyd'.  You can safely remove it manually.  WARNING: Failed to remove a temporary file 'C:\Users\ales\.envs\Lib\site-packages\~-tplotlib\_c_internal_utils.cp39-win_amd64.pyd' due to PermissionError: [WinError 5] Access is denied: 'C:\\Users\\ales\\.envs\\Lib\\site-packages\\~-tplotlib\\_c_internal_utils.cp39-win_amd64.pyd'.  You can safely remove it manually.  WARNING: Failed to remove a temporary file 'C:\Users\ales\.envs\Lib\site-packages\~-tplotlib\_path.cp39-win_amd64.pyd' due to PermissionError: [WinError 5] Access is denied: 'C:\\Users\\ales\\.envs\\Lib\\site-packages\\~-tplotlib\\_path.cp39-win_amd64.pyd'.  You can safely remove it manually.  WARNING: Failed to remove a temporary file 'C:\Users\ales\.envs\Lib\site-packages\~-tplotlib' due to OSError: [WinError 145] The directory is not empty: 'C:\\Users\\ales\\.envs\\Lib\\site-packages\\~-tplotlib'.  You can safely remove it manually.Successfully installed matplotlib-3.4.3

This alsofixes#6327 (similar problem on nfs)

l0b0 reacted with thumbs up emoji
@ales-erjavecales-erjavecforce-pushed thetemp-cleanup-ignore-errors branch 3 times, most recently from2a6b557 to1e903c2CompareAugust 22, 2022 10:40
@uranusjr
Copy link
Member

I wonder how viable it’d be to aggregate these removal failures and show just one warning message before the process exits instead. This can be quite spammy if a package contains a lot of files cannot be removed.

@horacehoff
Copy link

Is this even viable ? As@uranusjr said, it would be a mess when installing packages containing many files, and would spam the console. Perhaps leave this as an option ?

@ales-erjavec
Copy link
ContributorAuthor

I have changed it so only a single warning is displayed for a temporary directory.

...Installing collected packages: matplotlib  Attempting uninstall: matplotlib    Found existing installation: matplotlib 3.4.3    Uninstalling matplotlib-3.4.3:      Successfully uninstalled matplotlib-3.4.3  WARNING: Failed to remove contents of a temporary directory 'C:\Users\ales\.envs\Lib\site-packages\~6tplotlib'.  You can safely remove it manually.Successfully installed matplotlib-3.4.2

This is still done whenTempDirectory.cleanup is called.

TempDirectory does have means of beingglobally_managed (to cleanup at exit?), but the 'uninstall backups' do not use this and I do not feel comfortable changing this.

@ales-erjavecales-erjavecforce-pushed thetemp-cleanup-ignore-errors branch frombcc43f7 to149fbdaCompareJanuary 9, 2023 12:35
@tmacecode
Copy link

Hi. Is there anything blocking this PR being merged? This will fix a problem we are hitting regularly. Many thanks

l0b0 reacted with thumbs up emoji

ales-erjavecand others added5 commitsJuly 17, 2023 15:15
pip should not exit with an error when it fails to cleanup temporaryfiles after it has already successfully installed packages.
Preserve existing mode flags, handle case where we even lackpermission to change the mode.
Log individual errors at debug logging level.
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
@ales-erjavecales-erjavecforce-pushed thetemp-cleanup-ignore-errors branch from4d8d63c to2928750CompareJuly 17, 2023 13:25
l0b0 added a commit to linz/emergency-management-tools that referenced this pull requestJul 19, 2023
@uranusjruranusjr merged commitd064174 intopypa:mainJul 27, 2023
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsAug 12, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@uranusjruranusjruranusjr approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

pip 19.x --upgrade breaks on nfs
4 participants
@ales-erjavec@uranusjr@horacehoff@tmacecode

[8]ページ先頭

©2009-2025 Movatter.jp