Teichlab / celltypist

A tool for semi-automatic cell type classification
https://www.celltypist.org/
MIT License
284 stars 45 forks source link

unable to download models #98

Open mxiang1 opened 10 months ago

mxiang1 commented 10 months ago

Hi, I have been seeing the same timeout error message when trying to download models in both command line and python versions:

import celltypist from celltypist import models models.download_models(model = 'Immune_All_Low.pkl') 📜 Retrieving model list from server https://celltypist.cog.sanger.ac.uk/models/models.json Traceback (most recent call last): File "/home/users/mxiang1/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "/home/users/mxiang1/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn conn.connect() File "/home/users/mxiang1/.local/lib/python3.9/site-packages/urllib3/connection.py", line 419, in connect self.sock = ssl_wrapsocket( File "/home/users/mxiang1/.local/lib/python3.9/site-packages/urllib3/util/ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "/home/users/mxiang1/.local/lib/python3.9/site-packages/urllib3/util/ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/share/software/user/open/python/3.9.0/lib/python3.9/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/share/software/user/open/python/3.9.0/lib/python3.9/ssl.py", line 1040, in _create self.do_handshake() File "/share/software/user/open/python/3.9.0/lib/python3.9/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() socket.timeout: _ssl.c:1105: The handshake operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/users/mxiang1/.local/lib/python3.9/site-packages/requests/adapters.py", line 489, in send resp = conn.urlopen( File "/home/users/mxiang1/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen retries = retries.increment( File "/home/users/mxiang1/.local/lib/python3.9/site-packages/urllib3/util/retry.py", line 550, in increment raise six.reraise(type(error), error, _stacktrace) File "/home/users/mxiang1/.local/lib/python3.9/site-packages/urllib3/packages/six.py", line 770, in reraise raise value File "/home/users/mxiang1/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/home/users/mxiang1/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 389, in _make_request self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) File "/home/users/mxiang1/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 340, in _raise_timeout raise ReadTimeoutError( urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='celltypist.cog.sanger.ac.uk', port=443): Read timed out. (read timeout=30)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/users/mxiang1/.local/lib/python3.9/site-packages/celltypist/models.py", line 38, in _requests_get r = requests.get(url, timeout = timeout) File "/home/users/mxiang1/.local/lib/python3.9/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, kwargs) File "/home/users/mxiang1/.local/lib/python3.9/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, kwargs) File "/home/users/mxiang1/.local/lib/python3.9/site-packages/requests/sessions.py", line 587, in request resp = self.send(prep, send_kwargs) File "/home/users/mxiang1/.local/lib/python3.9/site-packages/requests/sessions.py", line 701, in send r = adapter.send(request, kwargs) File "/home/users/mxiang1/.local/lib/python3.9/site-packages/requests/adapters.py", line 578, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='celltypist.cog.sanger.ac.uk', port=443): Read timed out. (read timeout=30)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/home/users/mxiang1/.local/lib/python3.9/site-packages/celltypist/models.py", line 436, in download_models models_json = get_models_index(force_update) File "/home/users/mxiang1/.local/lib/python3.9/site-packages/celltypist/models.py", line 395, in get_models_index download_model_index() File "/home/users/mxiang1/.local/lib/python3.9/site-packages/celltypist/models.py", line 412, in download_model_index response = _requests_get(url) File "/home/users/mxiang1/.local/lib/python3.9/site-packages/celltypist/models.py", line 41, in _requests_get raise Exception( Exception: 🛑 Cannot fetch 'https://celltypist.cog.sanger.ac.uk/models/models.json', the error is: HTTPSConnectionPool(host='celltypist.cog.sanger.ac.uk', port=443): Read timed out. (read timeout=30)

I tried increasing read_timeout but it didn't change anything. Could you look into this? Thanks!

prete commented 10 months ago

Hi @mxiang1, thank you for using CellTypists.

Can you check if you can access the URL from a web broswer in the same network? Paste this in your browser: https://celltypist.cog.sanger.ac.uk/models/models.json does it load properly?

From the same environment you can try to retrieve the model list using wget or curl.

wget -O models.json https://celltypist.cog.sanger.ac.uk/models/models.json

Does that work?

If some of those still don't work, then it may be an issue with the web proxy on your network that's blocking the URL.

mxiang1 commented 10 months ago

Hi Prete,

​I tested the wget command and also failed to connect.

$ wget -O models.json https://celltypist.cog.sanger.ac.uk/models/models.json
--2023-11-17 08:59:00--  https://celltypist.cog.sanger.ac.uk/models/models.json
Resolving celltypist.cog.sanger.ac.uk (celltypist.cog.sanger.ac.uk)... 193.62.203.62, 193.62.203.63, 193.62.203.61
Connecting to celltypist.cog.sanger.ac.uk (celltypist.cog.sanger.ac.uk)|193.62.203.62|:443... connected.

Unable to establish SSL connection.

I'm connecting from our institutional HPC and the support team told me there seems to be a restriction put in place on the Sanger side which doesn't accept connections from Stanford systems.

edg1983 commented 6 months ago

The same is happening here.

Any attempt to download a model using the python API in our HPC fails due to connection timeout.

However, manual download from the browser in my personal laptop seems to work fine.

IsaacUtah1379 commented 1 month ago

I'm having the same problem. The Python API and wget fail due to connection timeout on the HPC I'm using but downloading from my desktop works fine.