我在尝试从终端启动 jupyter 笔记本时看到此错误。
Error loading server extension jupyterlab
Traceback (most recent call last):
File "/Users/kevalshah/myvenv/lib/python3.7/site-packages/notebook/notebookapp.py", line 2047, in init_server_extensions
mod = importlib.import_module(modulename)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/kevalshah/myvenv/lib/python3.7/site-packages/jupyterlab/__init__.py", line 7, in <module>
from .handlers.announcements import ( # noqa
File "/Users/kevalshah/myvenv/lib/python3.7/site-packages/jupyterlab/handlers/announcements.py", line 15, in <module>
from jupyterlab_server.translation_utils import translator
File "/Users/kevalshah/myvenv/lib/python3.7/site-packages/jupyterlab_server/__init__.py", line 5, in <module>
from .app import LabServerApp
File "/Users/kevalshah/myvenv/lib/python3.7/site-packages/jupyterlab_server/app.py", line 14, in <module>
from .handlers import LabConfig, add_handlers
File "/Users/kevalshah/myvenv/lib/python3.7/site-packages/jupyterlab_server/handlers.py", line 18, in <module>
from .listings_handler import ListingsHandler, fetch_listings
File "/Users/kevalshah/myvenv/lib/python3.7/site-packages/jupyterlab_server/listings_handler.py", line 8, in <module>
import requests
File "/Users/kevalshah/myvenv/lib/python3.7/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/Users/kevalshah/myvenv/lib/python3.7/site-packages/urllib3/__init__.py", line 42, in <module>
"urllib3 v2.0 only supports OpenSSL 1.1.1+, currently "
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.1.0h 27 Mar 2018'. See: https://github.com/urllib3/urllib3/issues/2168
我尝试升级并安装以下版本:
requests==2.31.0
urllib3==2.0.7
如何解决这个问题?我需要升级我的系统 OpenSSL 吗?
urllib3 v2.0 迁移指南指出他们有
删除了对 1.1.1 之前的 OpenSSL 版本的支持。
解决问题的最佳方法是升级到 >= python 3.8,然后运行
python -m pip install urllib3
。这是因为 urllib3 的稳定版本需要:Python >=3.8。
否则,请查看上面包含的迁移指南,以找到可能解决您问题的方法。