Is it safe to delete ~/.cache/pip directory

According to pip's caching documentation from version 6 you can use the --no-cache-dir option.

But that didn't help me as I was using a wrapper (pinax starter projects) that runs pip in the background to install several packages. Since I kept getting an pip.exceptions.HashErrors ('hashes don't match the requirement file) and I didn't want to temper with its code I renamed the pip cache folder and tried running my wrapper again. Once I noticed there weren't issues I proceeded to delete the entire cache pip folder. I haven't had any problem after that. So I can assume it is entirely a safe operation to delete pip's cache folder.

These are the locations where you can find your pip cache:

Unix

~/.cache/pip and it respects the XDG_CACHE_HOME directory.

OS X

~/Library/Caches/pip.

Windows

\pip\Cache


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.

Tags:

Pip