chembl / chembl_webresource_client

Official Python client for accessing ChEMBL API
https://www.ebi.ac.uk/chembl/api/data/docs
Other
377 stars 95 forks source link

[Errno 111] Connection refused #27

Closed subject-am closed 7 years ago

subject-am commented 7 years ago

Hi, I'm trying out the chembl_webresource_client for the first time, but I keep getting the same error every time I import new_client. Can you understand what's causing the problem from the error?

---------------------------------------------------------------------------
ConnectionRefusedError                    Traceback (most recent call last)
/home/subjectAM/anaconda3/lib/python3.6/site-packages/urllib3/connection.py in _new_conn(self)
    140             conn = connection.create_connection(
--> 141                 (self.host, self.port), self.timeout, **extra_kw)
    142 

/home/subjectAM/anaconda3/lib/python3.6/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
     82     if err is not None:
---> 83         raise err
     84 

/home/subjectAM/anaconda3/lib/python3.6/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options)
     72                 sock.bind(source_address)
---> 73             sock.connect(sa)
     74             return sock

/home/subjectAM/anaconda3/lib/python3.6/site-packages/gevent/_socket3.py in connect(self, address)
    306                 else:
--> 307                     raise error(result, strerror(result))
    308         finally:

ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

NewConnectionError                        Traceback (most recent call last)
/home/subjectAM/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    600                                                   body=body, headers=headers,
--> 601                                                   chunked=chunked)
    602 

/home/subjectAM/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    356         else:
--> 357             conn.request(method, url, **httplib_request_kw)
    358 

/home/subjectAM/anaconda3/lib/python3.6/http/client.py in request(self, method, url, body, headers, encode_chunked)
   1238         """Send a complete request to the server."""
-> 1239         self._send_request(method, url, body, headers, encode_chunked)
   1240 

/home/subjectAM/anaconda3/lib/python3.6/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
   1284             body = _encode(body, 'body')
-> 1285         self.endheaders(body, encode_chunked=encode_chunked)
   1286 

/home/subjectAM/anaconda3/lib/python3.6/http/client.py in endheaders(self, message_body, encode_chunked)
   1233             raise CannotSendHeader()
-> 1234         self._send_output(message_body, encode_chunked=encode_chunked)
   1235 

/home/subjectAM/anaconda3/lib/python3.6/http/client.py in _send_output(self, message_body, encode_chunked)
   1025         del self._buffer[:]
-> 1026         self.send(msg)
   1027 

/home/subjectAM/anaconda3/lib/python3.6/http/client.py in send(self, data)
    963             if self.auto_open:
--> 964                 self.connect()
    965             else:

/home/subjectAM/anaconda3/lib/python3.6/site-packages/urllib3/connection.py in connect(self)
    165     def connect(self):
--> 166         conn = self._new_conn()
    167         self._prepare_conn(conn)

/home/subjectAM/anaconda3/lib/python3.6/site-packages/urllib3/connection.py in _new_conn(self)
    149             raise NewConnectionError(
--> 150                 self, "Failed to establish a new connection: %s" % e)
    151 

NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f2dc11e1358>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

MaxRetryError                             Traceback (most recent call last)
/home/subjectAM/anaconda3/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    439                     retries=self.max_retries,
--> 440                     timeout=timeout
    441                 )

/home/subjectAM/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    638             retries = retries.increment(method, url, error=e, _pool=self,
--> 639                                         _stacktrace=sys.exc_info()[2])
    640             retries.sleep()

/home/subjectAM/anaconda3/lib/python3.6/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
    387         if new_retry.is_exhausted():
--> 388             raise MaxRetryError(_pool, url, error or ResponseError(cause))
    389 

MaxRetryError: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /chemblws/spore (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2dc11e1358>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

ConnectionError                           Traceback (most recent call last)
<ipython-input-13-2c837b71d511> in <module>()
----> 1 from chembl_webresource_client.new_client import new_client

/home/subjectAM/anaconda3/lib/python3.6/site-packages/chembl_webresource_client/new_client.py in <module>()
     68 #-----------------------------------------------------------------------------------------------------------------------
     69 
---> 70 new_client = client_from_url(Settings.Instance().NEW_CLIENT_URL + '/spore')
     71 
     72 #-----------------------------------------------------------------------------------------------------------------------

/home/subjectAM/anaconda3/lib/python3.6/site-packages/chembl_webresource_client/new_client.py in client_from_url(url, base_url)
     28 
     29     """
---> 30     res = requests.get(url)
     31     if not res.ok:
     32         raise Exception('Error getting schema from url {0} with status {1} and msg {2}'.format(url, res.status_code, res.text))

/home/subjectAM/anaconda3/lib/python3.6/site-packages/requests/api.py in get(url, params, **kwargs)
     70 
     71     kwargs.setdefault('allow_redirects', True)
---> 72     return request('get', url, params=params, **kwargs)
     73 
     74 

/home/subjectAM/anaconda3/lib/python3.6/site-packages/requests/api.py in request(method, url, **kwargs)
     56     # cases, and look like a memory leak in others.
     57     with sessions.Session() as session:
---> 58         return session.request(method=method, url=url, **kwargs)
     59 
     60 

/home/subjectAM/anaconda3/lib/python3.6/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    506         }
    507         send_kwargs.update(settings)
--> 508         resp = self.send(prep, **send_kwargs)
    509 
    510         return resp

/home/subjectAM/anaconda3/lib/python3.6/site-packages/requests/sessions.py in send(self, request, **kwargs)
    616 
    617         # Send the request
--> 618         r = adapter.send(request, **kwargs)
    619 
    620         # Total elapsed time of the request (approximately)

/home/subjectAM/anaconda3/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    506                 raise SSLError(e, request=request)
    507 
--> 508             raise ConnectionError(e, request=request)
    509 
    510         except ClosedPoolError as e:

ConnectionError: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /chemblws/spore (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2dc11e1358>: Failed to establish a new connection: [Errno 111] Connection refused',))
mnowotka commented 7 years ago

Hi, I can't reproduce it now but still happy to help. I would check two things:

  1. Do you have internet access?
  2. Can you check again to make sure that wasn't a temporary glitch.
subject-am commented 7 years ago

Hello, 1) I did have internet; 2) It most likely was, because I tried again today after seeing your reply and it just accepted, with no errors!

Thank you so much for your attention!

mnowotka commented 7 years ago

I'm glad to hear that! My apologies for a very late reply. If you happen to have any more problems like this please create another issue and I promise to be faster this time :)

subject-am commented 7 years ago

Don't worry about it, I understand that sometimes it's not possible to reply as soon as we'd like. As I'm just starting to work more with ChEMBL now, there might be a few :P Thank you you once again for the help!

On 3 Nov 2017 10:16, "Michał Nowotka" notifications@github.com wrote:

I'm glad to hear that! My apologies for a very late reply. If you happen to have any more problems like this please create another issue and I promise to be faster this time :)

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/chembl/chembl_webresource_client/issues/27#issuecomment-341664536, or mute the thread https://github.com/notifications/unsubscribe-auth/AeYMStK1yyJIgRA845GYxjd6jlJhnsUDks5syuf2gaJpZM4P8OwD .

mnowotka commented 7 years ago

In that particular case GitHub notifications were redirected to the wrong email address and I coudn't see them. It took me some time to figure this out but now it's fixed.