Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL: CERTIFICATE_VERIFY_FAILED error while downloading python -m spacy download en

Tags:

spacy

I have downloaded spacy in Anaconda prompt by using conda install -c conda-forge spacy. But when I tried to download en_core_we_sm using python -m spacy download en_core_web_sm I getting SSL: CERTIFICATE_VERIFY_FAILED error. Screen Shot

like image 301
Gokul Avatar asked Dec 05 '22 10:12

Gokul


2 Answers

With HTTPS, trying to download something from a remote host produces an SSL connection error in some cases like if your computer is behind a proxy which does not let you to make SSL connection freely. For those cases, a downloading manager like pip , conda for python or apt-get or yum for Linux provide some options for a user to specify certificate for such connections or to allow untrusted communication with a remote host for such downloads.

However, downloading a model VIA spacy with python -m spacy download does not provide such options. You cannot add any SSL certificates nor specify trusted host for a download.

Fortunately, there's a workaround solution with two separate steps , downloading and installing. That is, download the model with any other clients which is under control with SSL (browser, curl, wget...) then install the downloaded model with pip install

Find appropriate model you need on https://github.com/explosion/spacy-models/releases and download tar.gz file like,

wget https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.5/en_core_web_sm-2.2.5.tar.gz

Then install it like,

python -m pip install ./en_core_web_sm-2.2.5.tar.gz

like image 139
Lyle Avatar answered May 10 '23 02:05

Lyle


Just download the direct version.

python -m spacy download en_core_web_sm-2.2.0 --direct

I had the same error as you, gave this a try, and it worked. For more information here are some additional details from the model page: https://spacy.io/usage/models

like image 23
Gabe Verzino Avatar answered May 10 '23 01:05

Gabe Verzino