英文:
Persisting spaCy import error: NotOpenSSLWarning: urllib3 v2.0 only supports OpenSSL 1.1.1+
问题
我意识到这是一个最近常见的错误,但我在网上找到的解决方法都没有帮助我。我正在尝试在Mac OS上的Jupyter笔记本和VScode中使用spaCy,但每次我尝试导入spaCy时,都会出现以下错误:
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(
我尝试了以下操作:
brew install openssl@1.1
这没有起作用,所以我接着尝试降级urllib3:
pip install urllib3==1.26.6
这也没有起作用。我尝试使用虚拟环境,同样没有成功。我一直在网上搜索解决方案,但似乎没有什么能解决这个问题。
英文:
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 openssl@1.1
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.
答案1
得分: 1
这不是一个真正的spaCy问题,而是与Python安装相关的问题。你可以尝试安装一个较旧版本的urllib3,例如,我有一个虚拟环境,其中有spaCy 3.5和urllib3 1.26.15的最新版本,它运行良好:
pip install urllib3==1.26.15
如果这不起作用,请通过执行pip show urllib3
确认是否确实安装了该版本,以及您遇到了什么错误。另一个选项是构建或安装一个针对OpenSSL 1.1.1或更新版本构建的Python版本。
我尝试过执行:
brew install openssl@1.1
这通常不会起作用,因为Homebrew将openssl安装为keg-only,这意味着库不可见,除非您显式地链接到它。其次,SSL模块链接到libressl,这很可能有不同的共享库版本。最后,SSL模块可能会将库路径硬编码(在我的安装中是这样的)。
英文:
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 openssl@1.1
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).
答案2
得分: 0
我遇到了类似的问题,当尝试使用Python的 'requests' HTTP库时,出现了相同的错误消息。以下步骤在我的Apple M1 Pro - Ventura 13.5上使其正常工作。
安装Homebrew(如果尚未安装):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
或者使用他们的新 .pkg 安装程序:Homebrew 4.1.3
将Homebrew添加到您的PATH中(我使用bash):
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> ~/.bash_profile
安装最新版本的openssl:
brew install openssl@3.0
确保openssl在您的路径中排在首位,因为brew将其安装为独立版本。
echo 'export PATH="/opt/homebrew/opt/openssl@3.0/bin:$PATH"' >> /Users/<username>/.bash_profile
英文:
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 openssl@3.0
Make sure openssl is first in your path, since brew installs it as keg-only.
echo 'export PATH="/opt/homebrew/opt/openssl@3.0/bin:$PATH"' >> /Users/<username>/.bash_profile
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论