I want to known that how to clear pip cache safely?
1, Does pip have a cmd like "apt-get clean" to remove all the cached packages to make my system image smaller?
2, Can i remove /boot/.cache/pip and ~/.cache/pip manually?(use "sudo rm -rf /boot/.cache/pip" and "sudo rm -rf ~/.cache/pip")?
3, Does pip and pip3 use the same cache dir( /boot/.cache/pip and ~/.cache/pip)?
thank you.
/boot/
is the home)I'll also add that there's an idea to create a pip cache
command to make cache management easier --- #4685.
blindly deleting files or whole directories from the HTTP cache based on timestamp is safe
From #5110.
I think it is always safe to delete the cache, because it is a cache. Here's how I do it on Windows, which I'm constrained to use at work:
cd %USERPROFILE%\AppData\Local\pip
del /f /s /q cache > NUL
I do have to do this from time to time, because I will get PermissionError from Windows sometimes on accessing the cache, if too much stuff is in
Generally the obstacle to implementation is that anyone who wants to pick this up (and isn't already a Pip dev) needs to learn the internals and follow the idioms of the project. That's a nontrivial task.
Indeed @gwerbin! I made https://github.com/pypa/pip/issues/4685#issuecomment-464824545, in case someone wants to work on this and feel that's the blocker.
I am going to go ahead and close this in favor of #4685, as the long term resolution. @RonnyPfannschmidt's https://github.com/pypa/pip/issues/4830#issuecomment-341380689 answers all questions from OP.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Since this shows up in pip cache remove
web search, you can find more details about this here: https://stackoverflow.com/a/61762308/1931274
Most helpful comment
I'll also add that there's an idea to create a
pip cache
command to make cache management easier --- #4685.