SSL error while installing Spacy using pip

I’m trying to install spacy using pip

pip install -U spacy

but I’m getting this error

Could not fetch URL https://pypi.org/simple/spacy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host="pypi.org", port=443): Max retries exceeded with url: /simple/spacy/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)'))) - skipping
ERROR: Could not find a version that satisfies the requirement spacy (from versions: none)

so I tried to create the pip.ini file to add the trusted host

[global]
trusted-host = pypi.org
               pypi.python.org
               pypi.org
               pypi.co
               files.pythonhosted.org
               pip.pypa.io

And tried to run the pip again but I’m getting this 403 error

ERROR: HTTP error 403 while getting https://files.pythonhosted.org/packages/77/51/c40aa36f1835f187a5a727e1a3c2dcb44071a9f87ac2398352731fbed3fb/thinc-8.2.1-cp312-cp312-win_amd64.whl (from https://pypi.org/simple/thinc/) (requires-python:>=3.6)
ERROR: 403 Client Error: Forbidden for url: https://files.pythonhosted.org/packages/77/51/c40aa36f1835f187a5a727e1a3c2dcb44071a9f87ac2398352731fbed3fb/thinc-8.2.1-cp312-cp312-win_amd64.whl

how can I resolve this error? I’m running on a corporate internet and probably this is caused by a proxy but how can I install the certificate to python so I can run pip with https.

  • I’ve had success in such situations by specifying the proxy explicitly in the pip command, e.g., pip –proxy <company-proxy-address:port_number_if_needed> -install spacy

    – 

Leave a Comment