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] download error #207

Closed hh1985 closed 8 months ago

hh1985 commented 8 months ago

Describe the bug Cannot extract the metadata with pysradb. Received SSLError:

Traceback (most recent call last):
  File "/home/hanhu2023/miniconda3/bin/pysradb", line 8, in <module>
    sys.exit(parse_args())
             ^^^^^^^^^^^^
  File "/home/hanhu2023/miniconda3/lib/python3.11/site-packages/pysradb/cli.py", line 1172, in parse_args
    metadata(
  File "/home/hanhu2023/miniconda3/lib/python3.11/site-packages/pysradb/cli.py", line 68, in metadata
    df = sradb.sra_metadata(
         ^^^^^^^^^^^^^^^^^^^
  File "/home/hanhu2023/miniconda3/lib/python3.11/site-packages/pysradb/sraweb.py", line 415, in sra_metadata
    esummary_result = self.get_esummary_response("sra", srp)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hanhu2023/miniconda3/lib/python3.11/site-packages/pysradb/sraweb.py", line 257, in get_esummary_response
    request = requests.post(self.base_url["esearch"], data=OrderedDict(payload))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hanhu2023/miniconda3/lib/python3.11/site-packages/requests/api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hanhu2023/miniconda3/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hanhu2023/miniconda3/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hanhu2023/miniconda3/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hanhu2023/miniconda3/lib/python3.11/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/esearch.fcgi (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1006)')))

To Reproduce Steps to reproduce the behavior: pysradb metadata SRP000941 | head or pysradb metadata SRP000941 --saveto test.tsv

Desktop (please complete the following information):

Additional context Tried the command on home and office computers. Received the same error.

saketkc commented 8 months ago

SSL errors are intermittent from NCBI end. I do not see it anymore:

$ pysradb metadata SRP000941 | head
study_accession study_title experiment_accession    experiment_title    experiment_desc organism_taxid  organism_name   library_name    library_strategy    library_source  library_selection   library_layout  sample_accession    sample_title    biosample   bioproject  instrument  instrument_model    instrument_model_desc   total_spots total_size  run_accession   run_total_spots run_total_bases
SRP000941   UCSD Human Reference Epigenome Mapping Project  SRX027874   Reference Epigenome: ChIP-Seq Analysis of H3K9me3 in hESC Cells Reference Epigenome: ChIP-Seq Analysis of H3K9me3 in hESC Cells 9606    Homo sapiens    LL218   ChIP-Seq    GENOMIC ChIP    SINGLE  SRS006930       SAMN00004698    <NA>    Illumina Genome Analyzer II Illumina Genome Analyzer II ILLUMINA    59041190    1555248627  SRR018453   11642838    419142168
hh1985 commented 8 months ago

Just a note: I used proxy. I followed suggestion in github and downgraded the urllib3 to 1.25.11. Problem solved.

conda install urllib3=1.25.11