Deleting the pip Package Cache

Content:

From time to time, you might encounter an issue requiring your pip cache to be purged.

This could happen because you’re looking to install an older version of a pip installed package, for example.

The method to clear the cache is slightly different depending on the version of pip you have installed. You can check which version of pip you’re using by running

pip -V

Version 20.1+

Since version 20.1, pip includes a built-in command for clearing the cache. Simply run

pip cache purge

If you’d rather limit the cache cleanup to a specific package, use the remove command instead.

pip cache remove packagename

This is the better solution if you’re trying to resolve a package-specific issue.

Version <20.1

For older releases, the previous command is not available. You’ll instead need to clear the cache manually.

You can find the cached files in the relevant directory listed below.

%LocalAppData%\pip\Cache    # Windows
~/Library/Caches/pip        # Mac
~/.cache/pip                # Linux

Delete the contents of this folder to clear the cache.