-
Notifications
You must be signed in to change notification settings - Fork 3k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should 'pip cache purge' remove more than wheel files? #7372
Comments
So Same holds true with Also we cannot remove the A potential solution I could think of is to introduce options for
|
With the For To be clear, what I'm suggesting is basically doing the Python equivalent of these bash commands: [ -f "$PIP_CACHE_DIR/selfcheck.json" ] && rm "$PIP_CACHE_DIR/selfcheck.json"
rm -r $PIP_CACHE_DIR/{http,selfcheck,wheels}/* |
+1, assuming there's no technical reason for needing the empty subdirs and And my local Since #8910, pip 20.3 will also include It still leaves the directories: $ pip --version
pip 20.3.dev0 from /Users/hugo/github/pip/src/pip (python 3.9)
$ pip cache info
Package index page cache location: /Users/hugo/Library/Caches/pip/http
Package index page cache size: 318.8 MB
Number of HTTP files: 725
Wheels location: /Users/hugo/Library/Caches/pip/wheels
Wheels size: 9.1 MB
Number of wheels: 20
$ pip cache purge
Files removed: 745
$ pip cache info
Package index page cache location: /Users/hugo/Library/Caches/pip/http
Package index page cache size: 0 bytes
Number of HTTP files: 0
Wheels location: /Users/hugo/Library/Caches/pip/wheels
Wheels size: 0 bytes
Number of wheels: 0 In this case, 6,600+ empty dirs remain: $ find /Users/hugo/Library/Caches/pip/ | wc -l # find all files
7089
$ find /Users/hugo/Library/Caches/pip/ -type d | wc -l # find only directories
6683
$ find /Users/hugo/Library/Caches/pip/http/ | wc -l
5663
$ find /Users/hugo/Library/Caches/pip/http/ -type d | wc -l
5663
$ find /Users/hugo/Library/Caches/pip/selfcheck/ | wc -l
405
$ find /Users/hugo/Library/Caches/pip/selfcheck/ -type d | wc -l
1
$ find /Users/hugo/Library/Caches/pip/wheels/ | wc -l
1018
$ find /Users/hugo/Library/Caches/pip/wheels/ -type d | wc -l
1018 |
It's used as part of the "hey, upgrade your pip" messaging -- we shouldn't remove this. All OK to delete the empty directories. :) |
Looks like the single-file
|
Wow, that sucks. I wish I'd noticed and thought through the implications of #6855 at the time. I apparently now have a bunch of files in that directory, over half of which are for temporary virtualenvs that no longer exist, and most of the others are for throwaway environments that I haven't deleted yet but which haven't been used in months. Update: Looks like I did spot the implication here. Sadly the housekeeping issue never got dealt with, and I just closed #6956 because I only remembered it as being about the wheel cache. I'll reopen it to track clearing up these files. |
I'm working on a PR for this. To start, I'm focusing on three things:
The |
What's the problem this feature will solve?
#4685 says:
Currently
git cache purge
in #6391 only removes the*.whl
files from thepip/wheels/
directory.This leaves:
pip/wheels/
(eg. 1,608 dirs, 57 KB)pip/http/
(eg. 2,408 files, 6,850 dirs, 2.1 GB)selfcheck.json
andpip/selfcheck/
directory (eg. 45 files, 27 KB)Should they also be cleaned up?
pip cache --help
says `purge will "Remove all items from the cache", but it doesn't.Split out from #6391 (comment) for follow-up after #6391 is merged.
Describe the solution you'd like
Should
pip cache purge
remove thepip/wheels/
directory itself so all the subdirs are also cleaned up? In my case, it's only 57 KB afterwards, but I guess I don't need those at all, and there's potential for them to slow down the computer.And I also still have a 2.1 GB
pip/http/
directory after purge. Should that also be removed?And
selfcheck.json
andpip/selfcheck/
are only 27 KB, but shouldpurge
remove the wholepip/
cache dir?I think my[typo, cannot remember original]pip/wheels/
directory was quite small, especially when compared withpip/wheels/
.Alternative Solutions
Leave the files and directories as is, to accumulate.
Feature request Cross-platform command to return pip's cache directory #7350 would allow the user to find out where the cache directory is, and writing their own commands to delete files and directories. It'd be nicer for this to be built into
pip cache purge
.The text was updated successfully, but these errors were encountered: