问题
I can wget e.g. python coverage and pip install the package locally quickly and without any problem, but pip install coverage
takes forever. Using pip 1.3.1 in a virtual env on Ubuntu 12.04. Any idea what could be the hold-up?
回答1:
As Donald Stufft answered in pip issue 864, it happens because pip
crawls a lot of pages looking for package sdists, and this behavior was inherited from easy_install
. Some packages do not work if you remove that feature, and some guys started a new PEP to remove this external links behavior: PEP 438 - Transitioning to release-file hosting on PyPI
Donald said "Until PEP438 is implemented you can also use the restricted API of Crate.io, pip install -i https://restricted.crate.io/ this will only install releases that are directly hosted."
But as Marcus Smith mentioned in the virtualenv mailing list, you can download the package and its dependencies, and them ignore PyPI and use your download directory: http://www.pip-installer.org/en/latest/cookbook.html#fast-local-installs
Example using https://restricted.create.io to avoid the external links behavior:
$ pip install -i https://restricted.crate.io/ coverage
References:
- https://github.com/pypa/pip/issues/864
- http://www.python.org/dev/peps/pep-0438/
- https://groups.google.com/forum/?fromgroups=#!topic/python-virtualenv/UDWsPHKHvjY
来源:https://stackoverflow.com/questions/15629061/why-is-pip-so-slow-to-download-how-to-troubleshoot