Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] SSLError workarounds? #86

Open
DSLituiev opened this issue Jun 21, 2022 · 3 comments
Open

[BUG] SSLError workarounds? #86

DSLituiev opened this issue Jun 21, 2022 · 3 comments

Comments

@DSLituiev
Copy link

This seems to be a firewall related error, which has known workarounds for standard PIP install.

python -m quickumls.install . ~/repos/umls-files

Error:

python -m quickumls.install . ~/repos/umls-files
Determining if SpaCy for language "ENG" is installed...
SpaCy is not available! Attempting to download and install...
⚠ As of spaCy v3.0, shortcuts like 'en' are deprecated. Please use the
full pipeline package name 'en_core_web_sm' instead.
Traceback (most recent call last):
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/quickumls/install.py", line 130, in install_spacy
    spacy.load(SPACY_LANGUAGE_MAP[lang])
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/spacy/__init__.py", line 51, in load
    return util.load_model(
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/spacy/util.py", line 426, in load_model
    raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name]))  # type: ignore[index]
OSError: [E941] Can't find model 'en'. It looks like you're trying to load a model from a shortcut, which is obsolete as of spaCy v3.0. To load the model, use its full name instead:

nlp = spacy.load("en_core_web_sm")

For more details on the available models, see the models directory: https://spacy.io/models. If you want to create a blank model, use spacy.blank: nlp = spacy.blank("en")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn
    conn.connect()
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/urllib3/connection.py", line 414, in connect
    self.sock = ssl_wrap_socket(
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/ssl.py", line 512, in wrap_socket
    return self.sslsocket_class._create(
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/ssl.py", line 1070, in _create
    self.do_handshake()
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/ssl.py", line 1341, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/urllib3/connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /explosion/spacy-models/master/compatibility.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/quickumls/install.py", line 233, in <module>
    main()
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/quickumls/install.py", line 171, in main
    install_spacy(opts.language)
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/quickumls/install.py", line 134, in install_spacy
    spacy.cli.download(SPACY_LANGUAGE_MAP[lang])
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/spacy/cli/download.py", line 67, in download
    compatibility = get_compatibility()
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/spacy/cli/download.py", line 78, in get_compatibility
    r = requests.get(about.__compatibility__)
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/home/dlituiev/anaconda3/envs/spacy/lib/python3.10/site-packages/requests/adapters.py", line 563, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /explosion/spacy-models/master/compatibility.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))

**Environment **

  • OS: WSL Ubuntu
  • QuickUMLS version [e.g. 1.4]
  • UMLS version [e.g. 2022AA]
  • Python 3.10
  • spacy: spacy-3.3.1
  • en_core_web_sm is installed
@DSLituiev
Copy link
Author

it would be great to have --trusted-host argument

@DSLituiev
Copy link
Author

also it seems like an antiquated requirement for en language instead of a specific spacy model like en_core_web_sm (see spacy warning in the log)

@DSLituiev
Copy link
Author

I've patched it by replacing in constants.py: en -> en_core_web_sm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant