首页 > 解决方案 > 在 pip 安装 nbinteract 后,打开 Jupyter-Notebook 时出现内部服务器错误

问题描述

我在 anaconda 中使用 Jupyter-Notebooks 有一段时间了,但是在 pip 安装 nbinteract 5 分钟后,它停止工作......使用 Python3 创建/打开新笔记本时,我只收到“500:内部服务器错误”。

运行 pip 检查时,我收到以下消息:

spyder 4.2.5 requires pyqt5, which is not installed.
spyder 4.2.5 requires pyqtwebengine, which is not installed.
qdarkstyle 2.8.1 requires helpdev, which is not installed.
pylint 2.7.4 has requirement astroid<2.7,>=2.5.2, but you have astroid 2.5.
nbinteract 0.2.6 has requirement nbformat<5,>=4.4.0, but you have nbformat 5.1.3.
nbinteract 0.2.6 has requirement traitlets<5,>=4.3, but you have traitlets 5.0.5.
flake8 3.9.0 has requirement pycodestyle<2.8.0,>=2.7.0, but you have pycodestyle 2.6.0.
flake8 3.9.0 has requirement pyflakes<2.4.0,>=2.3.0, but you have pyflakes 2.2.0.
autopep8 1.5.6 has requirement pycodestyle>=2.7.0, but you have pycodestyle 2.6.0.

我尝试安装和更新/降级某些版本,但不知何故我未能摆脱错误并使 Jupyter-Notebooks 再次工作。

有人知道我的问题的答案并且会很乐意提供帮助吗?


anaconda 的应用程序启动错误如下:

[I 22:24:55.592 NotebookApp] The port 8888 is already in use, trying another port.
[I 22:24:55.592 NotebookApp] The port 8889 is already in use, trying another port.
[I 22:24:55.593 NotebookApp] The port 8890 is already in use, trying another port.
[I 22:24:55.593 NotebookApp] The port 8891 is already in use, trying another port.
[I 22:24:55.594 NotebookApp] The port 8892 is already in use, trying another port.
[I 2021-04-04 22:24:56.195 LabApp] JupyterLab extension loaded from C:\Users\gti228\Anaconda3\lib\site-packages\jupyterlab
[I 2021-04-04 22:24:56.195 LabApp] JupyterLab application directory is C:\Users\gti228\Anaconda3\share\jupyter\lab
[I 22:24:56.202 NotebookApp] Serving notebooks from local directory: C:\Users\gti228
[I 22:24:56.202 NotebookApp] Jupyter Notebook 6.3.0 is running at:
[I 22:24:56.202 NotebookApp] http://localhost:8886/?token=af2a3fb1e26d8a7e385fcbf5fb259770a769f37832f56ec3
[I 22:24:56.202 NotebookApp] or http://127.0.0.1:8886/?token=af2a3fb1e26d8a7e385fcbf5fb259770a769f37832f56ec3
[I 22:24:56.202 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 22:24:56.238 NotebookApp] 

To access the notebook, open this file in a browser:
file:///C:/Users/gti228/AppData/Roaming/jupyter/runtime/nbserver-1852-open.html
Or copy and paste one of these URLs:
http://localhost:8886/?token=af2a3fb1e26d8a7e385fcbf5fb259770a769f37832f56ec3
or http://127.0.0.1:8886/?token=af2a3fb1e26d8a7e385fcbf5fb259770a769f37832f56ec3
[I 22:25:01.506 NotebookApp] Creating new notebook in 
[E 22:25:03.800 NotebookApp] Uncaught exception GET /notebooks/Untitled5.ipynb?kernel_name=python3 (::1)
HTTPServerRequest(protocol='http', host='localhost:8886', method='GET', uri='/notebooks/Untitled5.ipynb?kernel_name=python3', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "C:\Users\gti228\Anaconda3\lib\site-packages\tornado\web.py", line 1704, in _execute
result = await result
File "C:\Users\gti228\Anaconda3\lib\site-packages\tornado\gen.py", line 775, in run
yielded = self.gen.send(value)
File "C:\Users\gti228\Anaconda3\lib\site-packages\notebook\notebook\handlers.py", line 95, in get
self.write(self.render_template('notebook.html',
File "C:\Users\gti228\Anaconda3\lib\site-packages\notebook\base\handlers.py", line 516, in render_template
return template.render(**ns)
File "C:\Users\gti228\Anaconda3\lib\site-packages\jinja2\environment.py", line 1090, in render
self.environment.handle_exception()
File "C:\Users\gti228\Anaconda3\lib\site-packages\jinja2\environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "C:\Users\gti228\Anaconda3\lib\site-packages\jinja2\_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "C:\Users\gti228\Anaconda3\lib\site-packages\notebook\templates\notebook.html", line 1, in top-level template code
{% extends "page.html" %}
File "C:\Users\gti228\Anaconda3\lib\site-packages\notebook\templates\page.html", line 154, in top-level template code
{% block header %}
File "C:\Users\gti228\Anaconda3\lib\site-packages\notebook\templates\notebook.html", line 115, in block "header"
{% for exporter in get_frontend_exporters() %}
File "C:\Users\gti228\Anaconda3\lib\site-packages\notebook\notebook\handlers.py", line 40, in get_frontend_exporters
for name in get_export_names():
File "C:\Users\gti228\Anaconda3\lib\site-packages\nbconvert\exporters\base.py", line 141, in get_export_names
e = get_exporter(exporter_name)(config=config)
File "C:\Users\gti228\Anaconda3\lib\site-packages\nbconvert\exporters\base.py", line 102, in get_exporter
if getattr(exporter(config=config), 'enabled', True):
File "C:\Users\gti228\Anaconda3\lib\site-packages\nbinteract\exporters.py", line 125, in __init__
self.template_path.insert(
AttributeError: 'InteractExporter' object has no attribute 'template_path'
[E 22:25:03.810 NotebookApp] {
"Host": "localhost:8886",
"Connection": "keep-alive",
"Sec-Ch-Ua": "\"Google Chrome\";v=\"89\", \"Chromium\";v=\"89\", \";Not A Brand\";v=\"99\"",
"Sec-Ch-Ua-Mobile": "?0",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 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-Dest": "document",
"Referer": "http://localhost:8886/tree",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9",
"Cookie": "username-localhost-8888=\"2|1:0|10:1617530584|23:username-localhost-8888|44:ZDNkNDU2ZDA3NGYyNDc0NzkwZGEwNzk2NDFkYzU1YTI=|73073e5bc4da93f3ca6bb048982ddfb8a7cd471cb458db4b8c1e86b04ad79830\"; _xsrf=2|3fdc3883|035f3fa6fdf56f701b82dc6a8900f5c9|1617530584; username-localhost-8889=\"2|1:0|10:1617560237|23:username-localhost-8889|44:MDU4Y2U2MzlkOGNiNGQzYzgxY2U5MTI4NWQ5MGVkMTk=|f6235458a23c053c5c2128189d0e8fcaf054ba31af7583f6155a7839d343cb91\"; username-localhost-8890=\"2|1:0|10:1617561224|23:username-localhost-8890|44:NDEyODgwNGUzYzY2NGJkOTgwNWE0NWQ5NjE0YjkyNGY=|6afc5e6ce6e41416ac9b402b373721e2036cac6eeae66422ec07428ef4610b1e\"; username-localhost-8891=\"2|1:0|10:1617562258|23:username-localhost-8891|44:NWM1MDAwNTQ1MzI0NDUyY2JlMDNlYzVlMTRjNTJhMTY=|bff04220cfe68aa43e166f8c4aac5f396933f8927c54baf8ec3a83dfa942f90c\"; username-localhost-8892=\"2|1:0|10:1617562842|23:username-localhost-8892|44:YmIxN2RjZTZhN2Q2NDkxYzk1YTA3ZDNkNDBlZmJkMTQ=|4783584bc1efde8f1f10691a31c11fc6f3c7af80eb7d171417ab6588b797f1a7\"; username-localhost-8952=\"2|1:0|10:1617565983|23:username-localhost-8952|44:NWEwNjVhYjhmNDI5NDMzNmI1M2YzMTg4NGRlMTBiMmY=|a6c0ce3806972e8d413c5ba826d2fa8849f02ec45cc63d16b8f9ab5f244ed80d\"; username-localhost-8961=\"2|1:0|10:1617566758|23:username-localhost-8961|44:NjdhMTdiM2YxY2MzNGU4NWFhYmU2NjI3OTNmNmMwZWE=|b4434f73ab6a98be44cf33451305ede3dd186c92a49360e3a88f02ae2a806a45\"; username-localhost-8979=\"2|1:0|10:1617566864|23:username-localhost-8979|44:M2ZiYjYxYmMyMWU2NDhkZWE5MzZjNzk1MjQyMzc2MDg=|0b6158b5fd75d50bc428d22e618480001930dca244a2222c4b665b707040afcb\"; username-localhost-8886=\"2|1:0|10:1617567897|23:username-localhost-8886|44:YmEwODVlNmE5MDgyNDM5ZjkwMWQ1M2VjNzlkMjM2NTY=|e16d3fe5b9282cac4098f9d32874e0acec328ab2f162aba3b7a4f8a4c6758af8\""
}
[E 22:25:03.810 NotebookApp] 500 GET /notebooks/Untitled5.ipynb?kernel_name=python3 (::1) 2245.990000ms referer=http://localhost:8886/tree

标签: pythonpipjupyter-notebookanacondainternal-server-error

解决方案


推荐阅读