How to preserve files downloaded by pip after failed installation?
If pip install a_package
fails (e.g. pip install matplotlib
in setuptools
isn't new enough), the next invokation of pip install my_package
causes the file to be downloaded again instead of just comparing a checksum of the downloaded file and the remote version). How can this be prevent (assuming that pip
has those capabilities)?
I don't have a copy of pip
to test it, but would the --download-cache <dir>
option be of any help? From what I can tell in the docs, it will save downloaded files there, and use them.
EDIT
I installed pip
, and I found a package that failed to install, and I tried to install it with --download-cache <dir>
. I then re-ran the install, and in the log it said that it was using the cache dir, as opposed to downloading it. So it does work.
Starting in version 6.0, pip
now handles its own caching: https://pip.pypa.io/en/latest/reference/pip_install.html#caching
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.