pip search django produces time out error

2019-01-18 14:26发布

coincidentally, I run pip search django command and I got time out error. even specifing a high value of timeout

Below the logs:

D:\PERFILES\rmaceissoft\virtualenvs\fancy_budget\Scripts>pip search django --timeout=300
Exception:
Traceback (most recent call last):
  File "D:\PERFILES\Marquez\rmaceissoft\Workspace\virtualenvs\fancy_budget\lib\s
ite-packages\pip-1.1-py2.7.egg\pip\basecommand.py", line 104, in main
    status = self.run(options, args)
  File "D:\PERFILES\Marquez\rmaceissoft\Workspace\virtualenvs\fancy_budget\lib\s
ite-packages\pip-1.1-py2.7.egg\pip\commands\search.py", line 34, in run
    pypi_hits = self.search(query, index_url)
  File "D:\PERFILES\Marquez\rmaceissoft\Workspace\virtualenvs\fancy_budget\lib\s
ite-packages\pip-1.1-py2.7.egg\pip\commands\search.py", line 48, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "C:\Python27\Lib\xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "C:\Python27\Lib\xmlrpclib.py", line 1575, in __request
    verbose=self.__verbose
  File "C:\Python27\Lib\xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "C:\Python27\Lib\xmlrpclib.py", line 1297, in single_request
    return self.parse_response(response)
  File "C:\Python27\Lib\xmlrpclib.py", line 1462, in parse_response
    data = stream.read(1024)
  File "C:\Python27\Lib\httplib.py", line 541, in read
    return self._read_chunked(amt)
  File "C:\Python27\Lib\httplib.py", line 574, in _read_chunked
    line = self.fp.readline(_MAXLINE + 1)
  File "C:\Python27\Lib\socket.py", line 476, in readline
    data = self._sock.recv(self._rbufsize)
timeout: timed out

Storing complete log in C:\Users\reiner\AppData\Roaming\pip\pip.log

however, another search command finish without problems:

pip search django-registration

Is that a bug of pip due to the big amount of packages name that contains "django"?

Note: speed internet connection = 2 Mbits

3条回答
Ridiculous、
2楼-- · 2019-01-18 15:01

There is too short default timeout set for pip by default. You should really set this environment variable PIP_DEFAULT_TIMEOUT to at least 60 (1 minute)

Source: http://www.pip-installer.org/en/latest/configuration.html

查看更多
3楼-- · 2019-01-18 15:15

The pypi is probably overloaded. Just enable mirror fallback and caching in pip. Maybe tune the timeout a bit. Add these in ~/.pip/pip.conf:

[global]
default-timeout = 60
download-cache = ~/.pip/cache

[install]
use-mirrors = true
查看更多
forever°为你锁心
4楼-- · 2019-01-18 15:22

the --timeout option doesn't seem to work properly.

I can install django properly by using either:

pip --default-timeout=60 install django

or

export PIP_DEFAULT_TIMEOUT=60
pip install django

Note: using pip version 1.2.1 on RHEL 6.3

Source: DjangoDay2012-Brescia.pdf, page 11

查看更多
登录 后发表回答