Reputation: 41
I realize this is a recently common error, but none of the solutions I have found online helped me. I am trying to work with spaCy in Jupyter notebook and VScode on a Mac OS , but every time I try to import spacy, I get the following error:
NotOpenSSLWarning: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
warnings.warn(
I tried
brew install [email protected]
This didn't work so I then tried to downgrade urllib3 using
pip install urllib3==1.26.6
didn't work either. I tried using a virtual environment, also didn't work. I've been scouring the web trying to find a solution but nothing seems to work.
Upvotes: 4
Views: 12729
Reputation: 1
You can solve this problem by changing the default Python version in the .zshrc file. After switching to the latest Python version, you can check by running:
which python3
which pip3
Make sure the output matches what you specified in the .zshrc file. Reloading the terminal may help if you find that the change hasn’t been applied.
Upvotes: 0
Reputation: 120
This is not really a spaCy issue, but an issue with the Python installation. You could try to install an older version of urllib3, for instance, I have a virtual environment with a recent version of spaCy 3.5 and urllib3 1.26.15, which works fine:
pip install urllib3==1.26.15
If that doesn't work, please confirm with pip show urllib3 that that version was indeed installed and what error you are getting. Another option would be to build or install a Python version that is built against OpenSSL 1.1.1 or newer.
I tried
brew install [email protected]
This will usually not work, because Homebrew installs openssl as a keg-only, meaning that the library is not visible, unless you explicitly link against it. Secondly, the SSL module links against libressl, which most likely has a different shared library version. Finally, the SSL module could have the library paths hardcoded (it does on my installation).
Upvotes: 7
Reputation: 139
I had a similar issue when trying to use the Python 'requests' HTTP library, same error message. The following steps got it working for me on Apple M1 Pro - Ventura 13.5.
Install Homebrew (If not already):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Or via their new .pkg installer: Homebrew 4.1.3
Add Homebrew to your PATH (I'm using bash):
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> ~/.bash_profile
Install latest version of openssl:
brew install [email protected]
Make sure openssl is first in your path, since brew installs it as keg-only.
echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> /Users/<username>/.bash_profile
Upvotes: 0