Jupyter Notebook 500:内部服务器错误(已经尝试了很多在线解决方案)

发布于 2025-01-16 22:16:39 字数 5210 浏览 2 评论 0原文

我无法访问或创建 Jupyter 笔记本,因为我看到一个带有消息“500:内部服务器错误”的页面。我有一台 Mac,我尝试在我的终端上运行某些解决方案。

以下是我尝试过的一些解决方案。

  1. 我尝试卸载并安装 Jupyter 和 Anaconda。
  2. 我在 stackoverflow 上找到的一种解决方案是升级 Jupyter(它没有解决我的问题): pip3 install --upgrade --user nbconvert
  3. 我尝试安装 nbconvert 最新版本 conda install nbconvert=6.4.4

说实话,我已经忘记了我尝试过实现的所有解决方案。我已经几个月无法访问 Jupyter 笔记本了,一直依赖 Google Colab 来完成项目。

我猜我的 Jupyter 环境搞砸了,而且我对如何修复它一无所知。

以下是每当我打开 Jupyter 笔记本时我的终端输出的内容:

\[C 13:11:19.237 NotebookApp\]

    To access the notebook, open this file in a browser:
        file:///Users/AntonioKuri/Library/Jupyter/runtime/nbserver-5832-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=748f1009fefe6f94b20c791e952262add527cdda6833dc98
     or http://127.0.0.1:8888/?token=748f1009fefe6f94b20c791e952262add527cdda6833dc98

[E 13:11:24.955 NotebookApp\] Uncaught exception GET /notebooks/Untitled1.ipynb (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/Untitled1.ipynb', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/tornado/web.py", line 1704, in \_execute
result = await result
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/tornado/gen.py", line 775, in run
yielded = self.gen.send(value)
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/notebook/notebook/handlers.py", line 95, in get
self.write(self.render_template('notebook.html',
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/notebook/base/handlers.py", line 516, in render_template
return template.render(\*\*ns)
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))*
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/jinja2/\_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
{% extends "page.html" %}
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/notebook/templates/page.html", line 154, in top-level template code
{% block header %}
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/notebook/templates/notebook.html", line 115, in block "header"
{% for exporter in get_frontend_exporters() %}
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/notebook/notebook/handlers.py", line 40, in get_frontend_exporters
for name in get_export_names():
File "/Users/AntonioKuri/.local/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 146, in get_export_names
e = get_exporter(exporter_name)(config=config)
File "/Users/AntonioKuri/.local/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 103, in get_exporter
if getattr(exporter(config=config), 'enabled', True):
File "/Users/AntonioKuri/.local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 332, in __init__
super().__init__(config=config, \*\*kw)
File "/Users/AntonioKuri/.local/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 118, in __init__
self.\_init_preprocessors()
File "/Users/AntonioKuri/.local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 499, in \_init_preprocessors
conf = self.\_get_conf()
File "/Users/AntonioKuri/.local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 519, in \_get_conf
if conf_path.exists():
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/pathlib.py", line 1424, in exists
self.stat()
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/pathlib.py", line 1232, in stat
return self.\_accessor.stat(self)
OSError: \[Errno 92\] Illegal byte sequence: '/Users/AntonioKuri/Library/Jupyter/nbconvert/templates/conf.json'
\[E 13:11:24.966 NotebookApp\] {
"Host": "localhost:8888",
"Connection": "keep-alive",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/\*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Sec-Gpc": "1",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-User": "?1",
"Sec-Fetch-Dest": "document",
"Referer": "http://localhost:8888/tree",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9,es;q=0.8",
"Cookie": "\_xsrf=2|ba57c094|b615c89faff8409396139c183a8c7650|1648160274; username-localhost-8888="2|1:0|10:1648239080|23:username-localhost-8888|44:MzYzY2Y2ZTYyMjBhNDJiZGIyZWJjMTg0ZTAwMmU5ZGM=|263f6d0cfe955495ac4f90708eba79c7a767524552dcbd6153784387b7b91944""
}
\[E 13:11:24.967 NotebookApp\] 500 GET /notebooks/Untitled1.ipynb (::1) 644.870000ms referer=http://localhost:8888/tree

I can't access or create a Jupyter notebook as I am referred to a page with message the "500 : Internal Server Error". I have a mac, and I've tried running certain solutions on my terminal.

Here are some solutions I've tried.

  1. I've tried uninstalling and installing Jupyter and Anaconda.
  2. One solution I found on stackoverflow was to upgrade Jupyter (it didn't solve my issue):
    pip3 install --upgrade --user nbconvert
  3. I've tried installing nbconvert latest version
    conda install nbconvert=6.4.4

To be honest I've lost track of all the solutions I've tried implementing. I havn't been been able to access a Jupyter notebook in months and have been relying on Google Colab for projects.

I'm guessing my Jupyter environment is messed up and I have not the slightest clue on how to fix it.

Here's what my terminal outputs whenever I open a Jupyter notebook:

\[C 13:11:19.237 NotebookApp\]

    To access the notebook, open this file in a browser:
        file:///Users/AntonioKuri/Library/Jupyter/runtime/nbserver-5832-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=748f1009fefe6f94b20c791e952262add527cdda6833dc98
     or http://127.0.0.1:8888/?token=748f1009fefe6f94b20c791e952262add527cdda6833dc98

[E 13:11:24.955 NotebookApp\] Uncaught exception GET /notebooks/Untitled1.ipynb (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/Untitled1.ipynb', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/tornado/web.py", line 1704, in \_execute
result = await result
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/tornado/gen.py", line 775, in run
yielded = self.gen.send(value)
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/notebook/notebook/handlers.py", line 95, in get
self.write(self.render_template('notebook.html',
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/notebook/base/handlers.py", line 516, in render_template
return template.render(\*\*ns)
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))*
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/jinja2/\_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/notebook/templates/notebook.html", line 1, in top-level template code
{% extends "page.html" %}
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/notebook/templates/page.html", line 154, in top-level template code
{% block header %}
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/notebook/templates/notebook.html", line 115, in block "header"
{% for exporter in get_frontend_exporters() %}
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/site-packages/notebook/notebook/handlers.py", line 40, in get_frontend_exporters
for name in get_export_names():
File "/Users/AntonioKuri/.local/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 146, in get_export_names
e = get_exporter(exporter_name)(config=config)
File "/Users/AntonioKuri/.local/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 103, in get_exporter
if getattr(exporter(config=config), 'enabled', True):
File "/Users/AntonioKuri/.local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 332, in __init__
super().__init__(config=config, \*\*kw)
File "/Users/AntonioKuri/.local/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 118, in __init__
self.\_init_preprocessors()
File "/Users/AntonioKuri/.local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 499, in \_init_preprocessors
conf = self.\_get_conf()
File "/Users/AntonioKuri/.local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 519, in \_get_conf
if conf_path.exists():
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/pathlib.py", line 1424, in exists
self.stat()
File "/Users/AntonioKuri/opt/anaconda3/lib/python3.9/pathlib.py", line 1232, in stat
return self.\_accessor.stat(self)
OSError: \[Errno 92\] Illegal byte sequence: '/Users/AntonioKuri/Library/Jupyter/nbconvert/templates/conf.json'
\[E 13:11:24.966 NotebookApp\] {
"Host": "localhost:8888",
"Connection": "keep-alive",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/\*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Sec-Gpc": "1",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-User": "?1",
"Sec-Fetch-Dest": "document",
"Referer": "http://localhost:8888/tree",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9,es;q=0.8",
"Cookie": "\_xsrf=2|ba57c094|b615c89faff8409396139c183a8c7650|1648160274; username-localhost-8888="2|1:0|10:1648239080|23:username-localhost-8888|44:MzYzY2Y2ZTYyMjBhNDJiZGIyZWJjMTg0ZTAwMmU5ZGM=|263f6d0cfe955495ac4f90708eba79c7a767524552dcbd6153784387b7b91944""
}
\[E 13:11:24.967 NotebookApp\] 500 GET /notebooks/Untitled1.ipynb (::1) 644.870000ms referer=http://localhost:8888/tree

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月下客 2025-01-23 22:16:39

回滚到版本对我个人有帮助:conda install nbconvert=5.4。1 您的操作描述中未指定此方法。您已更新至版本 6.4.4

Rolling back to version helped me personally: conda install nbconvert=5.4.1 this method was not specified in the description of your actions. You updated to version 6.4.4

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文