python 升级到jupyter notebook 7.0.0可生产500台:内部服务器错误

efzxgjgh  于 2023-08-02  发布在  Python
关注(0)|答案(2)|浏览(99)

在我的env的conda update --all之后,包括对jupyter notebook 7.0.0的升级,jupyter nbclassic不再允许创建或加载笔记本。
每当我尝试,我得到一个500: Internal Server Error,而且控制台显示以下[E ...]消息。
任何关于问题是什么以及如何解决问题的建议都是非常受欢迎的。

[I 2023-07-24 15:19:00.816 ServerApp] Creating new notebook in 
[E 2023-07-24 15:19:01.029 ServerApp] Uncaught exception GET /nbclassic/notebooks/Untitled.ipynb?kernel_name=python3 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/nbclassic/notebooks/Untitled.ipynb?kernel_name=python3', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/tornado/web.py", line 1786, in _execute
        result = await result
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/tornado/gen.py", line 786, in run
        yielded = self.gen.send(value)
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbclassic/notebook/handlers.py", line 101, in get
        self.write(self.render_template('notebook.html',
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/jupyter_server/base/handlers.py", line 639, in render_template
        return template.render(**ns)
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render
        self.environment.handle_exception()
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
        raise rewrite_traceback_stack(source=source)
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbclassic/templates/notebook.html", line 1, in top-level template code
        {% extends "page.html" %}
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbclassic/templates/page.html", line 190, in top-level template code
        {% block header %}
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbclassic/templates/notebook.html", line 115, in block 'header'
        {% for exporter in get_frontend_exporters() %}
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbclassic/notebook/handlers.py", line 46, in get_frontend_exporters
        for name in get_export_names():
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 150, in get_export_names
        e = get_exporter(exporter_name)(config=config)
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 109, in get_exporter
        exporter = [e for e in exporters if e.name == name or e.name == name.lower()][0].load()
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 209, in load
        module = import_module(match.group('module'))
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/importlib/__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 850, in exec_module
      File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/jupyter_contrib_nbextensions/__init__.py", line 5, in <module>
        import jupyter_nbextensions_configurator
      File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/jupyter_nbextensions_configurator/__init__.py", line 17, in <module>
        from notebook import version_info as nb_version_info
    ImportError: cannot import name 'version_info' from 'notebook' (/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/notebook/__init__.py)
[E 2023-07-24 15:19:01.034 NotebookApp] {
      "Host": "localhost:8888",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
      "Referer": "http://localhost:8888/nbclassic/tree",
      "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0"
    }
[E 2023-07-24 15:19:01.034 NotebookApp] 500 GET /nbclassic/notebooks/Untitled.ipynb?kernel_name=python3 (3732122b1ec04beabb60168cadc9cdf1@127.0.0.1) 152.26ms referer=http://localhost:8888/nbclassic/tree

字符串

nhaq1z21

nhaq1z211#

似乎有无数的原因为500: Internal Server Error for jupyter这是描述在互联网上。(特别是有很多建议可以升级/降级nbconvert)。我发现的这些都不适用于我的情况。
我的案子”不知何故(?)”似乎与最近从jupyter =7开始的笔记本扩展的迁移问题有关< 7 to >,正如OP中提到的err msgs的这一部分似乎表明:

File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/jupyter_nbextensions_configurator/__init__.py", line 17, in <module>
        from notebook import version_info as nb_version_info
ImportError: cannot import name 'version_info' from 'notebook' (/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/notebook/__init__.py)

字符串
无论如何,怀着沉重的心情,我做了一个conda remove jupyter_nbextensions_configurator,删除了它的依赖项,包括我心爱的nbextensions(SIGH),这解决了这里发布的问题。

kxe2p93d

kxe2p93d2#

conda install jupyter_contrib_nbextensions与notebook v7.0.0出现相同问题
也是“jupyter-nbextensions not found”while conda install nb_conda
尝试了python=3.9和=3.10 env,没有解决。

相关问题