# pip install fails



## choosy (Aug 19, 2015)

Hi,

I have FreeBSD 10.2-RC1 installed.

I installed devel/py-pip and I am trying to use it to install python packages. I get the same kind of timeout error no matter if I am installing python packages system wide (`pip install` as root) or from a virtual env.

This is the error:

```
root@thinky:~ # pip install pyflakes
Collecting pyflakes
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out. (read timeout=15)",)': /simple/pyflakes/
^COperation cancelled by user
root@thinky:~ # pip install -vvvv pyflakes
Collecting pyflakes
  Getting page https://pypi.python.org/simple/pyflakes/
  Starting new HTTPS connection (1): pypi.python.org
  Incremented Retry for (url='/simple/pyflakes/'): Retry(total=4, connect=None, read=None, redirect=None)
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out. (read timeout=15)",)': /simple/pyflakes/
  Starting new HTTPS connection (2): pypi.python.org
^CCleaning up...
Operation cancelled by user
Exception information:
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 372, in _make_request
  httplib_response = conn.getresponse(buffering=True)
TypeError: getresponse() got an unexpected keyword argument 'buffering'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/pip/basecommand.py", line 223, in main
  status = self.run(options, args)
  File "/usr/local/lib/python3.4/site-packages/pip/commands/install.py", line 293, in run
  wb.build(autobuilding=True)
  File "/usr/local/lib/python3.4/site-packages/pip/wheel.py", line 705, in build
  self.requirement_set.prepare_files(self.finder)
  File "/usr/local/lib/python3.4/site-packages/pip/req/req_set.py", line 334, in prepare_files
  functools.partial(self._prepare_file, finder))
  File "/usr/local/lib/python3.4/site-packages/pip/req/req_set.py", line 321, in _walk_req_to_install
  more_reqs = handler(req_to_install)
  File "/usr/local/lib/python3.4/site-packages/pip/req/req_set.py", line 461, in _prepare_file
  req_to_install.populate_link(finder, self.upgrade)
  File "/usr/local/lib/python3.4/site-packages/pip/req/req_install.py", line 249, in populate_link
  self.link = finder.find_requirement(self, upgrade)
  File "/usr/local/lib/python3.4/site-packages/pip/index.py", line 486, in find_requirement
  all_versions = self._find_all_versions(req.name)
  File "/usr/local/lib/python3.4/site-packages/pip/index.py", line 404, in _find_all_versions
  index_locations = self._get_index_urls_locations(project_name)
  File "/usr/local/lib/python3.4/site-packages/pip/index.py", line 378, in _get_index_urls_locations
  page = self._get_page(main_index_url)
  File "/usr/local/lib/python3.4/site-packages/pip/index.py", line 818, in _get_page
  return HTMLPage.get_page(link, session=self.session)
  File "/usr/local/lib/python3.4/site-packages/pip/index.py", line 928, in get_page
  "Cache-Control": "max-age=600",
  File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 477, in get
  return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.4/site-packages/pip/download.py", line 373, in request
  return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 465, in request
  resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 573, in send
  r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.4/site-packages/pip/_vendor/cachecontrol/adapter.py", line 46, in send
  resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/adapters.py", line 370, in send
  timeout=timeout
  File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 617, in urlopen
  release_conn=release_conn, **response_kw)
  File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
  body=body, headers=headers)
  File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 374, in _make_request
  httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.4/http/client.py", line 1171, in getresponse
  response.begin()
  File "/usr/local/lib/python3.4/http/client.py", line 351, in begin
  version, status, reason = self._read_status()
  File "/usr/local/lib/python3.4/http/client.py", line 313, in _read_status
  line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.4/socket.py", line 374, in readinto
  return self._sock.recv_into(b)
  File "/usr/local/lib/python3.4/ssl.py", line 751, in recv_into
  return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.4/ssl.py", line 623, in read
  v = self._sslobj.read(len, buffer)
KeyboardInterrupt

root@thinky:~ # uname -r
10.2-RC1
```

Eventually I pressed Ctrl+C, thus the stack trace, but just above the stack trace there's another error which seems to be the original one.
Does anyone know what could cause this?

Thanks


----------



## choosy (Aug 19, 2015)

I upgraded to 10.2-RELEASE and the problem is solved!


----------



## choosy (Aug 23, 2015)

Actually the problem re-appeared. So it's an on and off problem.  The same stacktrace.

It looks like it's blocked here:


```
response.begin()
  File "/usr/local/lib/python3.4/http/client.py", line 351, in begin
  version, status, reason = self._read_status()
  File "/usr/local/lib/python3.4/http/client.py", line 313, in _read_status
  line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.4/socket.py", line 374, in readinto
  return self._sock.recv_into(b)
  File "/usr/local/lib/python3.4/ssl.py", line 751, in recv_into
  return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.4/ssl.py", line 623, in read
  v = self._sslobj.read(len, buffer)
```


----------

