vanheeringen-lab/genomepy

certificate error when downloading an ensembl plant genome with annotations

Closed this issue · 4 comments

Hi,

I can download a macaca genome (EnsEMBL rel109) with annotations

I can also download Beta vulgaris (EnsEMBL plant rel54) without annotations BUT when I add --annotation I get a ssh certificate error

The error occurs after downloading the fasta file, probably going towards getting the annotation

(Same error for Arabibopsis thaliana)

Could it be that your base link url for annotations is not a match for plant genomes?

Can you please share how I can fix this?

Thanks in advance
Stephane

info: genomepy freshly installed using conda on ubuntu 22 server

`
(genomepy) $ genomepy install -g Beta_vulgaris_seq RefBeet-1.2.2 Ensembl
Using version 56
downloading from ftp://ftp.ensemblgenomes.org/pub//plants/release-56/fasta/beta_vulgaris/dna//Beta_vulgaris.RefBeet-1.2.2.dna_sm.toplevel.fa.gz...
done...
name: RefBeet-1.2.2
local name: RefBeet-1.2.2
fasta: Beta_vulgaris_seq/RefBeet-1.2.2/RefBeet-1.2.2.fa

(genomepy) $ genomepy install -g Beta_vulgaris_ann --annotation RefBeet-1.2.2 Ensembl
Using version 56
downloading from ftp://ftp.ensemblgenomes.org/pub//plants/release-56/fasta/beta_vulgaris/dna//Beta_vulgaris.RefBeet-1.2.2.dna_sm.toplevel.fa.gz...
done...
name: RefBeet-1.2.2
local name: RefBeet-1.2.2
fasta: Beta_vulgaris_ann/RefBeet-1.2.2/RefBeet-1.2.2.fa
Traceback (most recent call last):
File "/opt/miniconda3/envs/genomepy/lib/python3.7/urllib/request.py", line 1350, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/opt/miniconda3/envs/genomepy/lib/python3.7/http/client.py", line 1281, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/http/client.py", line 1327, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/http/client.py", line 1276, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/http/client.py", line 1036, in _send_output
self.send(msg)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/http/client.py", line 976, in send
self.connect()
File "/opt/miniconda3/envs/genomepy/lib/python3.7/http/client.py", line 1451, in connect
server_hostname=server_hostname)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/ssl.py", line 423, in wrap_socket
session=session
File "/opt/miniconda3/envs/genomepy/lib/python3.7/ssl.py", line 870, in _create
self.do_handshake()
File "/opt/miniconda3/envs/genomepy/lib/python3.7/ssl.py", line 1139, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'ftp.ensemblgenomes.org'. (_ssl.c:1091)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/miniconda3/envs/genomepy/bin/genomepy", line 11, in
load_entry_point('genomepy==0.5.5', 'console_scripts', 'genomepy')()
File "/opt/miniconda3/envs/genomepy/lib/python3.7/site-packages/click/core.py", line 1128, in call
return self.main(*args, **kwargs)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/miniconda3/envs/genomepy/lib/python3.7/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/site-packages/genomepy/cli.py", line 38, in install
regex=regex, invert_match=not(match), annotation=annotation)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/site-packages/genomepy/functions.py", line 203, in install_genome
p.download_annotation(name, genome_dir, localname=localname, version=version)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/site-packages/genomepy/provider.py", line 418, in download_annotation
version = self.get_version(ftp_site)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/site-packages/genomepy/provider.py", line 329, in get_version
response = urlopen(ftp_site + "/current_README")
File "/opt/miniconda3/envs/genomepy/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/urllib/request.py", line 1393, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/opt/miniconda3/envs/genomepy/lib/python3.7/urllib/request.py", line 1352, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'ftp.ensemblgenomes.org'. (_ssl.c:1091)>
`

Hey Stephane,

it seems you got an old version of genomepy! I successfully ran this command using genomepy 0.15:

genomepy install RefBeet-1.2.2 -g Beta_vulgaris_seq -a -p ensembl

Thanks Siebren,

I did not notice the version was changed.
The problem comes from the default linux conda version being set to 0.5.0 under ubuntu (https://anaconda.org/search?q=genomepy) while there exist indeed a 0.15.0 (noarch)
Conda update does not update 0.5.0 to 0.15.0 by itself.

I tryed to get 0.15.0 installed but conda takes ages to solve the env. If this fails.
I could not wait any longer so I aborted and installed using the pip approach you put in the readme.

git clone https://github.com/vanheeringen-lab/genomepy.git
conda env create -n genomepy -f genomepy/environment.yml
conda activate genomepy
pip install -e genomepy

it finally worked after I removed the -e in the last command which was behaving when run inside the git folder (probably confused with the genomepy folder present there)

If what I observed is reproducible at your side, it lay be good to adapt the readme.

Install now works for Beta vulgaris
thanks for your feedback and help

Thank you for letting me know!

I also get the older version of genomepy with Conda, and I'm pretty sure this is an issue in their code and let them know.

Cheers!

The installation instructions have been updated to bypass this conda bug