PythonPython

Stop PIP from re-downloading same packages over and over again

Jun 07, 2014 · Updated: Jul 12, 2021 · by Tim Kamanin

PIP has a habit of re-downloading same packages every time you run the pip install command. That's not so cool, especially, when you deploy packages from requirements.txt and one of the packages failed to build, running the following command:

installing requirements via pip
pip install -r requirements.txt

would lead pip to re-download all the packages again.

Thankfully there's a way to fix this easily: create a configuration file named ~/.pip/pip.conf, and add the following contents:

~/.pip/pip.conf
[global] download_cache = ~/.cache/pip 

That's all, since that very moment, pip will start to cache downloaded files in ~/.cache/pip and won't re-download them every time it needs them.

Hey, if you've found this useful, please share the post to help other folks find it:

There's even more:

Subscribe for updates

  • via Twitter: @timonweb
  • old school RSS:
  • or evergreen email ↓ ↓ ↓