GenomeDownloadError: FTP host not found: ftp.ebi.ac.uk
Closed this issue · 1 comments
mhfzsharmin commented
I am receiving the error even with simple genome access. Is there any alternate way to install genome from local directory?
for row in genomepy.search("GRCh38"):
print(row)
---------------------------------------------------------------------------
gaierror Traceback (most recent call last)
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/online.py:94](/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/online.py#line=93), in connect_ftp_link(link, timeout)
93 try:
---> 94 ftp = FTP(host, timeout=timeout)
95 except socket.gaierror:
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/ftplib.py:121](/data/sharminm2/conda/envs/grelu/lib/python3.12/ftplib.py#line=120), in FTP.__init__(self, host, user, passwd, acct, timeout, source_address, encoding)
120 if host:
--> 121 self.connect(host)
122 if user:
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/ftplib.py:158](/data/sharminm2/conda/envs/grelu/lib/python3.12/ftplib.py#line=157), in FTP.connect(self, host, port, timeout, source_address)
157 sys.audit("ftplib.connect", self, self.host, self.port)
--> 158 self.sock = socket.create_connection((self.host, self.port), self.timeout,
159 source_address=self.source_address)
160 self.af = self.sock.family
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/socket.py:828](/data/sharminm2/conda/envs/grelu/lib/python3.12/socket.py#line=827), in create_connection(address, timeout, source_address, all_errors)
827 exceptions = []
--> 828 for res in getaddrinfo(host, port, 0, SOCK_STREAM):
829 af, socktype, proto, canonname, sa = res
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/socket.py:963](/data/sharminm2/conda/envs/grelu/lib/python3.12/socket.py#line=962), in getaddrinfo(host, port, family, type, proto, flags)
962 addrlist = []
--> 963 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
964 af, socktype, proto, canonname, sa = res
gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
GenomeDownloadError Traceback (most recent call last)
Cell In[14], line 1
----> 1 for row in genomepy.search("GRCh38"):
2 print(row)
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/providers/__init__.py:135](/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/providers/__init__.py#line=134), in search(term, provider, exact, size)
109 def search(term: str or int, provider: str = None, exact=False, size=False):
110 """
111 Search for term in genome names and descriptions (if term contains text. Case-insensitive),
112 assembly accession IDs (if term starts with GCA_ or GCF_),
(...)
133 genome name, provider and metadata
134 """
--> 135 for p in online_providers(provider):
136 for row in p.search(term, exact, size):
137 ret = list(row[:1]) + [p.name] + list(row[1:])
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/providers/__init__.py:104](/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/providers/__init__.py#line=103), in online_providers(provider)
102 for provider in providers:
103 try:
--> 104 yield create(provider)
105 except ConnectionError as e:
106 logger.warning(str(e))
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/providers/__init__.py:60](/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/providers/__init__.py#line=59), in create(name)
58 p = PROVIDERS[name]
59 p.download_assembly_report = staticmethod(download_assembly_report)
---> 60 return p()
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/providers/gencode.py:39](/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/providers/gencode.py#line=38), in GencodeProvider.__init__(self)
38 def __init__(self):
---> 39 self._provider_status()
40 # Populate on init, so that methods can be cached
41 self.genomes = _get_genomes(self._url)
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/providers/base.py:59](/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/providers/base.py#line=58), in BaseProvider._provider_status(self)
57 def _provider_status(self):
58 """check if provider is online"""
---> 59 if not self.ping():
60 raise ConnectionError(f"{self.name} appears to be offline.")
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/providers/gencode.py:49](/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/providers/gencode.py#line=48), in GencodeProvider.ping()
46 @staticmethod
47 def ping():
48 """Can the provider be reached?"""
---> 49 ftp_online = bool(check_url("ftp.ebi.ac.uk/pub/databases/gencode"))
50 return ftp_online
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/online.py:146](/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/online.py#line=145), in check_url(url, max_tries, timeout)
142 return True
144 return False
--> 146 return retry(_check_url, max_tries, url, timeout)
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/online.py:117](/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/online.py#line=116), in retry(func, tries, *args, **kwargs)
115 for n in range(tries):
116 try:
--> 117 answer = func(*args, **kwargs)
118 return answer
119 except (urllib.error.HTTPError, error_temp):
120 # HTTPError 404: URL not found
121 # FTP error_temp 450: file not found
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/online.py:134](/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/online.py#line=133), in check_url.<locals>._check_url(_url, _timeout)
132 def _check_url(_url, _timeout):
133 if _url.startswith("ftp"):
--> 134 ftp, target = connect_ftp_link(_url, timeout=_timeout)
135 listing = retry(ftp.nlst, 1, target)
136 ftp.quit() # logout
File [/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/online.py:96](/data/sharminm2/conda/envs/grelu/lib/python3.12/site-packages/genomepy/online.py#line=95), in connect_ftp_link(link, timeout)
94 ftp = FTP(host, timeout=timeout)
95 except socket.gaierror:
---> 96 raise GenomeDownloadError(f"FTP host not found: {host}")
97 ftp.login()
98 return ftp, target
GenomeDownloadError: FTP host not found: ftp.ebi.ac.uk
mhfzsharmin commented
I resolved it by manual installation of genomepy bash commands.