Caching packages downloaded by "pip"

Downloading Python packages using the pip installer can be a pain in the ass mainly when you have to install the same packages in distinct "virtualenvs" and your Internet connection is slow or PyPI servers are quite busy. Anyway, caching is always a faster solution, right?

So, to deal with it I've setup pip to cache each package downloaded by it. The most straight way to do it is by using the parementer --download-cache:

pip install --download-cache ~/.cache/pip django

But you don't want type this long command over and over... Well, so just set the environment variable PIP_DOWNLOAD_CACHE to ~/.cache/pip or to whatever you want.

I personally prefer setup it globally, by configuring ~/.pip/pip.conf with the content below:

# ~/.pip/pip.conf
download_cache = ~/.cache/pip

[ SSD Virtual Servers in 55 Seconds. Only $5/mo! ]