I install a lot of the same packages in different virtualenv environments. Is there a way that I can download a package once and then have pip install from a local cache?
This would reduce download bandwidth and time.
According to the Pip documentation:
Starting with v6.0, pip provides an on by default cache which functions similarly to that of a web browser. While the cache is on by default and is designed do the right thing by default you can disable the cache and always access PyPI by utilizing the
--no-cache-dir
option.
Therefore, the updated answer is to just use pip with its defaults if you want a download cache.
From the pip news, version 0.1.4:
Added support for an environmental variable $PIP_DOWNLOAD_CACHE which will cache package downloads, so future installations won’t require large downloads. Network access is still required, but just some downloads will be avoided when using this.
To take advantage of this, I've added the following to my ~/.bash_profile
:
export PIP_DOWNLOAD_CACHE=$HOME/.pip_download_cache
or, if you are on a Mac:
export PIP_DOWNLOAD_CACHE=$HOME/Library/Caches/pip-downloads
PIP_DOWNLOAD_CACHE
directory. For instance, I now have quite a few Django packages. virtualenvs
on the airplane, but it's still great.