Clear pip Cache

Clear pip Cache

The pip has a caching mechanism that stores downloaded Python packages and locally built wheels. It allows to speed up package installation process because less amount of time is spent for downloading and building duplicates. There might be a case, that the pip don't update package to the latest version because it retrieved from the cache. This tutorial shows how to clear pip cache.

Since pip 20.1, the pip cache command can be used for managing the pip cache. The purge argument allows to clear all cache.

pip cache purge
pip3 cache purge

In Linux, the pip cache also stored in the /root/.cache/pip directory. To delete it execute command with sudo privileges:

sudo pip cache purge
sudo pip3 cache purge

In versions prior to pip 20.1, delete the cache directory manually.

rd /s /q "%LocalAppData%\pip\cache"
sudo rm -rf /root/.cache/pip
rm -rf ~/.cache/pip

Leave a Comment

Cancel reply

Your email address will not be published.