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

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

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

  1. [I 2023-07-24 15:19:00.816 ServerApp] Creating new notebook in
  2. [E 2023-07-24 15:19:01.029 ServerApp] Uncaught exception GET /nbclassic/notebooks/Untitled.ipynb?kernel_name=python3 (127.0.0.1)
  3. 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')
  4. Traceback (most recent call last):
  5. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/tornado/web.py", line 1786, in _execute
  6. result = await result
  7. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/tornado/gen.py", line 786, in run
  8. yielded = self.gen.send(value)
  9. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbclassic/notebook/handlers.py", line 101, in get
  10. self.write(self.render_template('notebook.html',
  11. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/jupyter_server/base/handlers.py", line 639, in render_template
  12. return template.render(**ns)
  13. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render
  14. self.environment.handle_exception()
  15. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
  16. raise rewrite_traceback_stack(source=source)
  17. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbclassic/templates/notebook.html", line 1, in top-level template code
  18. {% extends "page.html" %}
  19. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbclassic/templates/page.html", line 190, in top-level template code
  20. {% block header %}
  21. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbclassic/templates/notebook.html", line 115, in block 'header'
  22. {% for exporter in get_frontend_exporters() %}
  23. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbclassic/notebook/handlers.py", line 46, in get_frontend_exporters
  24. for name in get_export_names():
  25. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 150, in get_export_names
  26. e = get_exporter(exporter_name)(config=config)
  27. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 109, in get_exporter
  28. exporter = [e for e in exporters if e.name == name or e.name == name.lower()][0].load()
  29. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 209, in load
  30. module = import_module(match.group('module'))
  31. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/importlib/__init__.py", line 127, in import_module
  32. return _bootstrap._gcd_import(name[level:], package, level)
  33. File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  34. File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  35. File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  36. File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  37. File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  38. File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  39. File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  40. File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  41. File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  42. File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  43. File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  44. File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  45. File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  46. File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  47. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/jupyter_contrib_nbextensions/__init__.py", line 5, in <module>
  48. import jupyter_nbextensions_configurator
  49. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/jupyter_nbextensions_configurator/__init__.py", line 17, in <module>
  50. from notebook import version_info as nb_version_info
  51. ImportError: cannot import name 'version_info' from 'notebook' (/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/notebook/__init__.py)
  52. [E 2023-07-24 15:19:01.034 NotebookApp] {
  53. "Host": "localhost:8888",
  54. "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
  55. "Referer": "http://localhost:8888/nbclassic/tree",
  56. "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0"
  57. }
  58. [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的这一部分似乎表明:

  1. File "/home/UserX/.anaconda3/envs/py/lib/python3.9/site-packages/jupyter_nbextensions_configurator/__init__.py", line 17, in <module>
  2. from notebook import version_info as nb_version_info
  3. 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,没有解决。

相关问题