bayer-science-for-a-better-life / Img2Mol

Apache License 2.0
108 stars 41 forks source link

When I run the code with `res = img2mol(filepath="examples/digital_example1.png", cddd_server=cddd_server)` in example_inference.ipynb I get the followed error #4

Closed CAVUling closed 2 years ago

CAVUling commented 2 years ago

TimeoutError Traceback (most recent call last) ~/anaconda3/envs/img2mol/lib/python3.8/site-packages/urllib3/connection.py in _new_conn(self) 158 try: --> 159 conn = connection.create_connection( 160 (self._dns_host, self.port), self.timeout, **extra_kw

~/anaconda3/envs/img2mol/lib/python3.8/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options) 83 if err is not None: ---> 84 raise err 85

~/anaconda3/envs/img2mol/lib/python3.8/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options) 73 sock.bind(source_address) ---> 74 sock.connect(sa) 75 return sock

TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

NewConnectionError Traceback (most recent call last) ~/anaconda3/envs/img2mol/lib/python3.8/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) 669 # Make the request on the httplib connection object. --> 670 httplib_response = self._make_request( 671 conn,

~/anaconda3/envs/img2mol/lib/python3.8/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, httplib_request_kw) 391 else: --> 392 conn.request(method, url, httplib_request_kw) 393

~/anaconda3/envs/img2mol/lib/python3.8/http/client.py in request(self, method, url, body, headers, encode_chunked) 1254 """Send a complete request to the server.""" -> 1255 self._send_request(method, url, body, headers, encode_chunked) 1256

~/anaconda3/envs/img2mol/lib/python3.8/http/client.py in _send_request(self, method, url, body, headers, encode_chunked) 1300 body = _encode(body, 'body') -> 1301 self.endheaders(body, encode_chunked=encode_chunked) 1302

~/anaconda3/envs/img2mol/lib/python3.8/http/client.py in endheaders(self, message_body, encode_chunked) 1249 raise CannotSendHeader() -> 1250 self._send_output(message_body, encode_chunked=encode_chunked) 1251

~/anaconda3/envs/img2mol/lib/python3.8/http/client.py in _send_output(self, message_body, encode_chunked) 1009 del self._buffer[:] -> 1010 self.send(msg) 1011

~/anaconda3/envs/img2mol/lib/python3.8/http/client.py in send(self, data) 949 if self.auto_open: --> 950 self.connect() 951 else:

~/anaconda3/envs/img2mol/lib/python3.8/site-packages/urllib3/connection.py in connect(self) 186 def connect(self): --> 187 conn = self._new_conn() 188 self._prepare_conn(conn)

~/anaconda3/envs/img2mol/lib/python3.8/site-packages/urllib3/connection.py in _new_conn(self) 170 except SocketError as e: --> 171 raise NewConnectionError( 172 self, "Failed to establish a new connection: %s" % e

NewConnectionError: <urllib3.connection.HTTPConnection object at 0x2b1c5e957700>: Failed to establish a new connection: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

MaxRetryError Traceback (most recent call last) ~/anaconda3/envs/img2mol/lib/python3.8/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 438 if not chunked: --> 439 resp = conn.urlopen( 440 method=request.method,

~/anaconda3/envs/img2mol/lib/python3.8/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) 725 --> 726 retries = retries.increment( 727 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]

~/anaconda3/envs/img2mol/lib/python3.8/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace) 445 if new_retry.is_exhausted(): --> 446 raise MaxRetryError(_pool, url, error or ResponseError(cause)) 447

MaxRetryError: HTTPConnectionPool(host='ec2-18-157-240-87.eu-central-1.compute.amazonaws.com', port=8892): Max retries exceeded with url: /cddd_to_smiles/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x2b1c5e957700>: Failed to establish a new connection: [Errno 110] Connection timed out'))

During handling of the above exception, another exception occurred:

ConnectionError Traceback (most recent call last)

in ----> 1 res = img2mol(filepath="examples/digital_example1.png", cddd_server=cddd_server) ~/project/lig_amine/Img2Mol-main/img2mol/inference.py in __call__(self, filepath, cddd_server, return_cddd) 122 cddd = np.median(cddd, axis=0) 123 --> 124 smiles = cddd_server.cddd_to_smiles(cddd.tolist()) 125 mol = Chem.MolFromSmiles(smiles, sanitize=True) 126 # if the molecule is valid, i.e. can be parsed with the rdkit ~/project/lig_amine/Img2Mol-main/img2mol/cddd_server.py in cddd_to_smiles(self, embedding) 48 url = "{}:{}/cddd_to_smiles/".format(self.host, self.port) 49 req = json.dumps({"cddd": embedding}) ---> 50 response = requests.post(url, data=req, headers=self.headers, verify=False) 51 return json.loads(response.content.decode("utf-8")) 52 ~/anaconda3/envs/img2mol/lib/python3.8/site-packages/requests/api.py in post(url, data, json, **kwargs) 117 """ 118 --> 119 return request('post', url, data=data, json=json, **kwargs) 120 121 ~/anaconda3/envs/img2mol/lib/python3.8/site-packages/requests/api.py in request(method, url, **kwargs) 59 # cases, and look like a memory leak in others. 60 with sessions.Session() as session: ---> 61 return session.request(method=method, url=url, **kwargs) 62 63 ~/anaconda3/envs/img2mol/lib/python3.8/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) 528 } 529 send_kwargs.update(settings) --> 530 resp = self.send(prep, **send_kwargs) 531 532 return resp ~/anaconda3/envs/img2mol/lib/python3.8/site-packages/requests/sessions.py in send(self, request, **kwargs) 641 642 # Send the request --> 643 r = adapter.send(request, **kwargs) 644 645 # Total elapsed time of the request (approximately) ~/anaconda3/envs/img2mol/lib/python3.8/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 514 raise SSLError(e, request=request) 515 --> 516 raise ConnectionError(e, request=request) 517 518 except ClosedPoolError as e: ConnectionError: HTTPConnectionPool(host='ec2-18-157-240-87.eu-central-1.compute.amazonaws.com', port=8892): Max retries exceeded with url: /cddd_to_smiles/ (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 110] Connection timed out'))
ap-- commented 2 years ago

Hi @CAVUling,

Please try again. It should be fixed now.

Cheers, Andreas πŸ˜ƒ

CAVUling commented 2 years ago

Hi @CAVUling,

Please try again. It should be fixed now.

Cheers, Andreas πŸ˜ƒ

It worked! Thank you so much!

ap-- commented 2 years ago

πŸŽ‰ great! If you need further help, please open a new issue.

Have a great day! Cheers, Andreas πŸ˜ƒ

MachineGUN001 commented 2 years ago

πŸŽ‰ great! If you need further help, please open a new issue.

Have a great day! Cheers, Andreas πŸ˜ƒ

hi, the same issues happened again.

ConnectionError: HTTPConnectionPool(host='ec2-18-157-240-87.eu-central-1.compute.amazonaws.com', port=8892): Max retries exceeded with url: /cddd_to_smiles/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001DD22F25908>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

how can i fix it up? many thanks,