繁体   English   中英

Jupyter Notebook(Ubuntu 20.04.02 LTS)“500:内部服务器错误”

[英]Jupyter Notebook (Ubuntu 20.04.02 LTS) "500: Internal Server Error"

在创建新的 Jupyter 笔记本文件并上传.ipynb文件时,它在我的浏览器中抛出 500: Internal Server Error。

我的终端上的回溯如下:

 kapil@kapil-Lenovo-G500s:~$ jupyter notebook
 [I 15:44:57.728 NotebookApp] Serving notebooks from local directory: 
 /home/kapil
 [I 15:44:57.728 NotebookApp] Jupyter Notebook 6.3.0 is running at:
 [I 15:44:57.728 NotebookApp] http://localhost:8888/? 
 token=ccfe1774cdc6a572e8f56c8db8bb44e7132694c8d42db606
 [I 15:44:57.728 NotebookApp]  or http://127.0.0.1:8888/? 
 token=ccfe1774cdc6a572e8f56c8db8bb44e7132694c8d42db606
 [I 15:44:57.728 NotebookApp] Use Control-C to stop this server and 
 shut down all kernels (twice to skip confirmation).
 [C 15:44:57.932 NotebookApp] 

 To access the notebook, open this file in a browser:
    file:///home/kapil/.local/share/jupyter/runtime/nbserver-23514-open.html

Or copy and paste one of these URLs:
    http://localhost:8888/?token=ccfe1774cdc6a572e8f56c8db8bb44e7132694c8d42db606
 or http://127.0.0.1:8888/?token=ccfe1774cdc6a572e8f56c8db8bb44e7132694c8d42db606


 [E 15:46:10.268 NotebookApp]
 Uncaught exception GET /notebooks/Data_Science_Uploads/1st_.ipynb (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/notebooks/Data_Science_Uploads/1st_.ipynb', version='HTTP/1.1', remote_ip='127.0.0.1')

Traceback (most recent call last):
  File "/home/kapil/.local/lib/python3.8/site-packages/tornado/web.py", line 1704, in _execute
    result = await result
  File "/home/kapil/.local/lib/python3.8/site-packages/tornado/gen.py", line 775, in run
    yielded = self.gen.send(value)
  File "/home/kapil/.local/lib/python3.8/site-packages/notebook/notebook/handlers.py", line 95, in get
    self.write(self.render_template('notebook.html',
  File "/home/kapil/.local/lib/python3.8/site-packages/notebook/base/handlers.py", line 516, in render_template
    return template.render(**ns)
  File "/home/kapil/.local/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/home/kapil/.local/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/home/kapil/.local/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/home/kapil/.local/lib/python3.8/site-packages/notebook/templates/notebook.html", line 1, in top-level template code

    {% extends "page.html" %}
  File "/home/kapil/.local/lib/python3.8/site-packages/notebook/templates/page.html", line 154, in top-level template code
    {% block header %}
  File "/home/kapil/.local/lib/python3.8/site-packages/notebook/templates/notebook.html", line 115, in block "header"
    {% for exporter in get_frontend_exporters() %}
  File "/home/kapil/.local/lib/python3.8/site-packages/notebook/notebook/handlers.py", line 23, in get_frontend_exporters

    from nbconvert.exporters.base import get_export_names, get_exporter
  File "/home/kapil/.local/lib/python3.8/site-packages/nbconvert/__init__.py", line 4, in <module>


    from .exporters import *

  File "/home/kapil/.local/lib/python3.8/site-packages/nbconvert/exporters/__init__.py", line 4, in <module>
    from .slides import SlidesExporter
  File "/home/kapil/.local/lib/python3.8/site-packages/nbconvert/exporters/slides.py", line 12, in <module>
    from ..preprocessors.base import Preprocessor
  File "/home/kapil/.local/lib/python3.8/site-packages/nbconvert/preprocessors/__init__.py", line 7, in <module>
    from .csshtmlheader import CSSHTMLHeaderPreprocessor
  File "/home/kapil/.local/lib/python3.8/site-packages/nbconvert/preprocessors/csshtmlheader.py", line 14, in <module>
    from jupyterlab_pygments import JupyterStyle
  File "/home/kapil/.local/lib/python3.8/site-packages/jupyterlab_pygments/__init__.py", line 4, in <module>
    from .style import JupyterStyle
  File "/home/kapil/.local/lib/python3.8/site-packages/jupyterlab_pygments/style.py", line 10, in <module>
    class JupyterStyle(Style):
  File "/usr/lib/python3/dist-packages/pygments/style.py", line 101, in __new__
    ndef[0] = colorformat(styledef)
  File "/usr/lib/python3/dist-packages/pygments/style.py", line 58, in colorformat
    assert False, "wrong color format %r" % text

AssertionError: wrong color format 'var(--jp-mirror-editor-variable-color)'

 [E 15:46:10.406 NotebookApp] {
  "Host": "localhost:8888",
  "Connection": "keep-alive",
  "Sec-Ch-Ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"90\", \"Google Chrome\";v=\"90\"",
  "Sec-Ch-Ua-Mobile": "?0",
  "Upgrade-Insecure-Requests": "1",
  "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) 


 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 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-Fetch-Site": "same-origin",
  "Sec-Fetch-Mode": "navigate",
  "Sec-Fetch-User": "?1",
  "Sec-Fetch-Dest": "document",
  "Referer": "http://localhost:8888/tree/Data_Science_Uploads",
  "Accept-Encoding": "gzip, deflate, br",
  "Accept-Language": "en-GB,en-US;q=0.9,en;q=0.8",
  "Cookie": 

 "_xsrf=2|b4e13c52|438baf9f426518b37dd5a89993f6e77c|1617212946; username-localhost-8888=\"2|1:0|10:1618740901|23:username-localhost-8888|44:ZTIyYWVkYzU0Zjg3NDliNmEwMzZmNWY1ZTg0YTkxNTY=|17d17d693f8e86bab1f21b4dd777eb8bef0f88c8e6b842441b6c63d7e47400d2\""
}

  [E 15:46:10.406 NotebookApp] 500 GET /notebooks/Data_Science_Uploads/1st_.ipynb (127.0.0.1) 779.540000ms referer=http://localhost:8888/tree/Data_Science_Uploads

如果有人有,请提出任何解决方案,对我有很大帮助。

由于 Pygments 2.3.1 版本,我遇到了同样的问题。

python3 -m pip install -r requirements.txt

其中文件 requirements.txt 的内容是:

Pygments>=2.6.1

参考

[1] https://packaging.python.org/tutorials/installing-packages/

[2] https://pip.pypa.io/en/latest/user_guide/#requirements-files

[3] https://pypi.org/project/Pygments/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM