Forums

Failed to establish a new connection: [Errno 101] Network is unreachable

Hi, I'm on a paid plan (today). I try this requests code on IPython notebook and got connection failed error messages. Does anybody know what the problem is?

r = requests.get('http://google.com')


ConnectionError Traceback (most recent call last) <ipython-input-26-45fd01e1f020> in <module>() ----> 1 r = requests.get('http://google.com')

/usr/local/lib/python2.7/dist-packages/requests/api.pyc in get(url, params, kwargs) 69 70 kwargs.setdefault('allow_redirects', True) ---> 71 return request('get', url, params=params, kwargs) 72 73

/usr/local/lib/python2.7/dist-packages/requests/api.pyc in request(method, url, kwargs) 55 # cases, and look like a memory leak in others. 56 with sessions.Session() as session: ---> 57 return session.request(method=method, url=url, kwargs) 58 59

/usr/local/lib/python2.7/dist-packages/requests/sessions.pyc in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 473 } 474 send_kwargs.update(settings) --> 475 resp = self.send(prep, **send_kwargs) 476 477 return resp

/usr/local/lib/python2.7/dist-packages/requests/sessions.pyc in send(self, request, **kwargs) 604 605 # Resolve redirects if allowed. --> 606 history = [resp for resp in gen] if allow_redirects else [] 607 608 # Shuffle things around if there's history.

/usr/local/lib/python2.7/dist-packages/requests/sessions.pyc in resolve_redirects(self, resp, req, stream, timeout, verify, cert, proxies, adapter_kwargs) 177 proxies=proxies, 178 allow_redirects=False, --> 179 adapter_kwargs 180 ) 181

/usr/local/lib/python2.7/dist-packages/requests/sessions.pyc in send(self, request, kwargs) 583 584 # Send the request --> 585 r = adapter.send(request, kwargs) 586 587 # Total elapsed time of the request (approximately)

/usr/local/lib/python2.7/dist-packages/requests/adapters.pyc in send(self, request, stream, timeout, verify, cert, proxies) 465 raise ProxyError(e, request=request) 466 --> 467 raise ConnectionError(e, request=request) 468 469 except ClosedPoolError as e:

ConnectionError: HTTPConnectionPool(host='www.google.com', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f67b5661b10>: Failed to establish a new connection: [Errno 101] Network is unreachable',))

We have a bug that means that the network configuration for notebooks is sometimes not updated to reflect an upgrade. I have manually fixed it for you, so it should work now.

Thanks a lot, glenn!

Hi Glenn,

I have the same issue apparently, and on a paid plan too. Could you fix it for me too?

Thanks, nicolas

r = requests.get('http://google.com')


OSError Traceback (most recent call last) /usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py in _new_conn(self) 141 conn = connection.create_connection( --> 142 (self.host, self.port), self.timeout, **extra_kw) 143

/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options) 90 if err is not None: ---> 91 raise err 92

/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options) 80 sock.bind(source_address) ---> 81 sock.connect(sa) 82 return sock

OSError: [Errno 101] Network is unreachable

During handling of the above exception, another exception occurred:

NewConnectionError Traceback (most recent call last) /usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, **response_kw) 577 body=body, headers=headers, --> 578 chunked=chunked) 579

/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, httplib_request_kw) 361 else: --> 362 conn.request(method, url, httplib_request_kw) 363

/usr/lib/python3.4/http/client.py in request(self, method, url, body, headers) 1124 """Send a complete request to the server.""" -> 1125 self._send_request(method, url, body, headers) 1126

/usr/lib/python3.4/http/client.py in _send_request(self, method, url, body, headers) 1162 body = body.encode('iso-8859-1') -> 1163 self.endheaders(body) 1164

/usr/lib/python3.4/http/client.py in endheaders(self, message_body) 1120 raise CannotSendHeader() -> 1121 self._send_output(message_body) 1122

/usr/lib/python3.4/http/client.py in _send_output(self, message_body) 950 message_body = None --> 951 self.send(msg) 952 if message_body is not None:

/usr/lib/python3.4/http/client.py in send(self, data) 885 if self.auto_open: --> 886 self.connect() 887 else:

/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py in connect(self) 166 def connect(self): --> 167 conn = self._new_conn() 168 self._prepare_conn(conn)

/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py in _new_conn(self) 150 raise NewConnectionError( --> 151 self, "Failed to establish a new connection: %s" % e) 152

NewConnectionError: <requests.packages.urllib3.connection.HTTPConnection object at 0x7fca22b11630>: Failed to establish a new connection: [Errno 101] Network is unreachable

During handling of the above exception, another exception occurred:

MaxRetryError Traceback (most recent call last) /usr/local/lib/python3.4/dist-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 402 retries=self.max_retries, --> 403 timeout=timeout 404 )

/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, **response_kw) 622 retries = retries.increment(method, url, error=e, _pool=self, --> 623 _stacktrace=sys.exc_info()[2]) 624 retries.sleep()

/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace) 280 if new_retry.is_exhausted(): --> 281 raise MaxRetryError(_pool, url, error or ResponseError(cause)) 282

MaxRetryError: HTTPConnectionPool(host='google.com', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7fca22b11630>: Failed to establish a new connection: [Errno 101] Network is unreachable',))

During handling of the above exception, another exception occurred:

ConnectionError Traceback (most recent call last) <ipython-input-11-45fd01e1f020> in <module>() ----> 1 r = requests.get('http://google.com')

/usr/local/lib/python3.4/dist-packages/requests/api.py in get(url, params, kwargs) 69 70 kwargs.setdefault('allow_redirects', True) ---> 71 return request('get', url, params=params, kwargs) 72 73

/usr/local/lib/python3.4/dist-packages/requests/api.py in request(method, url, kwargs) 55 # cases, and look like a memory leak in others. 56 with sessions.Session() as session: ---> 57 return session.request(method=method, url=url, kwargs) 58 59

/usr/local/lib/python3.4/dist-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 473 } 474 send_kwargs.update(settings) --> 475 resp = self.send(prep, **send_kwargs) 476 477 return resp

/usr/local/lib/python3.4/dist-packages/requests/sessions.py in send(self, request, kwargs) 583 584 # Send the request --> 585 r = adapter.send(request, kwargs) 586 587 # Total elapsed time of the request (approximately)

/usr/local/lib/python3.4/dist-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 465 raise ProxyError(e, request=request) 466 --> 467 raise ConnectionError(e, request=request) 468 469 except ClosedPoolError as e:

ConnectionError: HTTPConnectionPool(host='google.com', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7fca22b11630>: Failed to establish a new connection: [Errno 101] Network is unreachable',))

Sorry about that! Should be fixed now.

I am having the same issue as well in my two notebooks. Can you work your magic to get it to work? Thanks!

Again, sorry about that! That's done.

Same happened to me. Can mine be fixed too? I would be grateful!

hi there- as a free user, you cannot use notebooks- are you sure you have the same notebook error?