huangnengCSU / compleasm

A genome completeness evaluation tool based on miniprot
Apache License 2.0
172 stars 16 forks source link

socket.gaierror: [Errno -2] Name or service not known #30

Closed yeeus closed 6 months ago

yeeus commented 6 months ago

I run compleasm with the command:

compleasm run -a mat.fasta -o compleasm_mat -t 30 -l primates \
              -L /path/to/compleasm_lineages_library/primates_odb10/

where the library was downloaded from here with the latest version:2024-01-08 And I got errors:

Traceback (most recent call last):
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 1346, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 1285, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 1331, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 980, in send
    self.connect()
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 1447, in connect
    super().connect()
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 946, in connect
    self.sock = self._create_connection(
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/socket.py", line 823, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/path/to/mambaforge/envs/python3.9/bin/compleasm", line 10, in <module>
    sys.exit(main())
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/site-packages/compleasm.py", line 2737, in main
    args.func(args)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/site-packages/compleasm.py", line 2601, in run
    mr = CompleasmRunner(assembly_path=assembly_path,
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/site-packages/compleasm.py", line 2114, in __init__
    self.downloader = Downloader(library_path)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/site-packages/compleasm.py", line 85, in __init__
    self.lineage_description, self.placement_description = self.download_file_version_document()
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/site-packages/compleasm.py", line 127, in download_file_version_document
    urllib.request.urlretrieve(hash_url, hash_download_path)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 239, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 1389, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 1349, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>
file_versions.tsv.tmp exists, another process is downloading, please run again later.

It seems compleasm was trying to download something and this case is like #6. However, our cluster has no internet access on nodes so can you give an option like --offline in busco?

huangnengCSU commented 6 months ago

Hi @yeeus,

If the node has no internet access, you may use compleasm download on the node with internet access to download the required lineage and then use compleasm run on the computing node. Running compleasm for the first time requires downloading some necessary files. You don't need to download them again when you run it later.

yeeus commented 6 months ago

When I run compleasm download primates, I got this error:

Traceback (most recent call last):
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 1346, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 1285, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 1331, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 980, in send
    self.connect()
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 1447, in connect
    super().connect()
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/http/client.py", line 946, in connect
    self.sock = self._create_connection(
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/socket.py", line 844, in create_connection
    raise err
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/socket.py", line 832, in create_connection
    sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/path/to/mambaforge/envs/python3.9/bin/compleasm", line 10, in <module>
    sys.exit(main())
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/site-packages/compleasm.py", line 2737, in main
    args.func(args)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/site-packages/compleasm.py", line 2497, in download
    downloader = Downloader(args.library_path)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/site-packages/compleasm.py", line 85, in __init__
    self.lineage_description, self.placement_description = self.download_file_version_document()
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/site-packages/compleasm.py", line 127, in download_file_version_document
    urllib.request.urlretrieve(hash_url, hash_download_path)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 239, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 1389, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/path/to/mambaforge/envs/python3.9/lib/python3.9/urllib/request.py", line 1349, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 110] Connection timed out>

You know, in some reasons, the network of clusters often has problems in China. So I suggest you could add an option like --offline in busco and therefore we can download the needed library locally without running compleasm download primates in the notorious cluster... Best wishes!

huangnengCSU commented 6 months ago

@yeeus,

You can run compleasm download primates locally then upload the download folder to the server. Even I add "--offline", you still need to run compleasm download primates locally as well.

huangnengCSU commented 6 months ago

I will add a new option "--offline" and update compleasm can support BUSCO lineage file directly. So that user can download and decompress the lineage manually to avoid the problem caused by the internet.

yeeus commented 6 months ago

Thank you very much!!! I downloaded the lineage file using compleasm download primates in my windows and upload it to the cluster server, and now compleasm has been running without any problems!