saketkc / pysradb

Package for fetching metadata and downloading data from SRA/ENA/GEO
https://saketkc.github.io/pysradb
BSD 3-Clause "New" or "Revised" License
303 stars 49 forks source link

[BUG]Downloading issue #208

Closed OrigamiSheep closed 7 months ago

OrigamiSheep commented 7 months ago

Describe the bug When I download a GEO data, I find the Openssl issue, how to fix it? thanks Traceback (most recent call last): File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 467, in _make_request self._validate_conn(conn) File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1096, in _validate_conn conn.connect() File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/urllib3/connection.py", line 642, in connect sock_and_verified = _ssl_wrap_socket_and_match_hostname( File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/urllib3/connection.py", line 782, in _ssl_wrap_socket_and_match_hostname ssl_sock = ssl_wrap_socket( File "/home/sheep_1217/miniconda3/envs/10xenv/lib/python3.10/site-packages/urllib3/util/ssl.py", line 470, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname) File "/home/sheep_1217/miniconda3/envs/10xenv/lib/python3.10/site-packages/urllib3/util/ssl.py", line 514, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/ssl.py", line 1104, in _create self.do_handshake() File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/ssl.py", line 1375, in do_handshake self._sslobj.do_handshake() ssl.SSLEOFError: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1007)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 790, in urlopen response = self._make_request( File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 491, in _make_request raise new_e urllib3.exceptions.SSLError: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1007)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 844, in urlopen retries = retries.increment( File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/urllib3/util/retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='eutils.ncbi.nlm.nih.gov', port=443): Max retries exceeded with url: /entrez/eutils/esummary.fcgi?db=sra&usehistory=n&retmode=json&query_key=1&WebEnv=MCID_65a1f2ca2e77e108540d52bb&retstart=0&retmax=500 (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1007)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/sheep_1217/miniconda3/envs/10x_env/bin/pysradb", line 10, in sys.exit(parse_args()) File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/pysradb/cli.py", line 1181, in parse_args download( File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/pysradb/cli.py", line 114, in download metadata = sradb.sra_metadata(srp_x, detailed=True) File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/pysradb/sraweb.py", line 415, in sra_metadata esummary_result = self.get_esummary_response("sra", srp) File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/pysradb/sraweb.py", line 298, in get_esummary_response request = requests.get( File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, kwargs) File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, kwargs) File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, kwargs) File "/home/sheep_1217/miniconda3/envs/10x_env/lib/python3.10/site-packages/requests/adapters.py", line 517, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='eutils.ncbi.nlm.nih.gov', port=443): Max retries exceeded with url: /entrez/eutils/esummary.fcgi?db=sra&usehistory=n&retmode=json&query_key=1&WebEnv=MCID_65a1f2ca2e77e108540d52bb&retstart=0&retmax=500 (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1007)')))

To Reproduce Steps to reproduce the behavior: pysradb download -y -t 8 --out-dir /home/sheep_1217/SRP363708/1.sra -p SRP363708

Desktop (please complete the following information):

saketkc commented 7 months ago

Thanks, this is a known issue. Please see https://github.com/saketkc/pysradb/issues/201#issuecomment-1843076201 for a workaround.