I have limited space on my server, and I am thinking to delete the cache of the PIP. I am not sure if its safe to delete or not.
ls ~/.cache/pip/
Contains following dir/files.
http selfcheck.json wheels
$ pip -V pip 7.1.2 from /usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg (python 2.7)
Please advise.
pip provides an on-by-default caching, designed to reduce the amount of time spent on duplicate downloads and builds.
cache directory, for example for pip to install desired version of package. Yes you can delete all of . cache with no long term detrimental effects.
Using --no-cache-dir flag in pip install ,make sure dowloaded packages by pip don't cached on system . This is a best practise which make sure to fetch ftom repo instead of using local cached one . Further , in case of Docker Containers , by restricing caching , we can reduce image size.
For the most part you can delete most anything in your home directory, programs or applications that require . cache (or other dot files such as . local ) will re-create them. Most of the time, at worst, you will lose custom configurations, but no real harm to the system.
Since pip 20.1b1, which was released on 21 April 2020 and "added pip cache
command for inspecting/managing pip’s wheel cache", you no longer need to. Instead, you can issue this command:
pip cache purge
The reference guide is here:
https://pip.pypa.io/en/stable/reference/pip_cache/
The corresponding pull request is here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With