登录 jupyterhub 时,报告 500 : Internal Server Error
Posted
技术标签:
【中文标题】登录 jupyterhub 时,报告 500 : Internal Server Error【英文标题】:when log in jupyterhub ,report 500 : Internal Server Error 【发布时间】:2022-01-07 21:22:12 【问题描述】:我从源代码安装 jupyterhub,版本是 0.9.4。我尝试使用 root 用户登录,但服务器响应 500 消息。
500 : 内部服务器错误 Spawner 无法启动 [status=1]。 root 的日志可能包含详细信息。 您可以尝试从主页重启服务器。
然后我点击主页并启动我的服务器,它失败并显示消息:
生成失败:http://192.168.183.148:47297/user/root/ 的服务器在 30 秒内没有响应
我的 jupyterhub_config.py
c.JupyterHub.authenticator_class = 'dummyauthenticator.DummyAuthenticator'
c.JupyterHub.bind_url = 'http://192.168.183.148:8000'
c.JupyterHub.data_files_path = '/usr/local/share/jupyterhub'
c.Spawner.ip = '192.168.183.148'
c.Authenticator.admin_users = 'root'
c.Authenticator.whitelist = 'root','vinwin'
c.PAMAuthenticator.encoding = 'utf8'
[root@localhost jupyter]# jupyterhub -f jupyterhub_config.py
控制台日志:
[I 2021-12-01 03:46:26.857 JupyterHub app:1673] Using Authenticator:dummyauthenticator.dummyauthenticator.DummyAuthenticator
[I 2021-12-01 03:46:26.857 JupyterHub app:1673] Using Spawner: jupyterhub.spawner.LocalProcessSpawner-0.9.4
[I 2021-12-01 03:46:26.858 JupyterHub app:1055] Writing cookie_secret to /etc/jupyter/jupyterhub_cookie_secret
[I 2021-12-01 03:46:26.883 alembic.runtime.migration migration:155] Context impl SQLiteImpl.
[I 2021-12-01 03:46:26.884 alembic.runtime.migration migration:162] Will assume non-transactional DDL.
[I 2021-12-01 03:46:26.890 alembic.runtime.migration migration:517] Running stamp_revision -> 896818069c98
[I 2021-12-01 03:46:26.931 JupyterHub proxy:431] Generating new CONFIGPROXY_AUTH_TOKEN
[I 2021-12-01 03:46:26.987 JupyterHub app:1855] Hub API listening on http://127.0.0.1:8081/hub/
[W 2021-12-01 03:46:26.988 JupyterHub proxy:565] Running JupyterHub without SSL. I hope there is SSL termination happening somewhere else...
[I 2021-12-01 03:46:26.988 JupyterHub proxy:567] Starting proxy @ http://192.168.183.148:8000
03:46:27.217 [ConfigProxy] info: Proxying http://192.168.183.148:8000 to (no default)
03:46:27.220 [ConfigProxy] info: Proxy API at http://127.0.0.1:8001/api/routes
(node:53082) ExperimentalWarning: queueMicrotask() is experimental.
03:46:27.854 [ConfigProxy] info: 200 GET /api/routes
[I 2021-12-01 03:46:27.855 JupyterHub proxy:301] Checking routes
[I 2021-12-01 03:46:27.855 JupyterHub proxy:370] Adding default route for Hub: / => http://127.0.0.1:8081
03:46:27.861 [ConfigProxy] info: Adding route / -> http://127.0.0.1:8081
03:46:27.862 [ConfigProxy] info: Route added / -> http://127.0.0.1:8081
03:46:27.863 [ConfigProxy] info: 201 POST /api/routes/
[I 2021-12-01 03:46:27.867 JupyterHub app:1912] JupyterHub is now running at http://192.168.183.148:8000
[I 2021-12-01 03:46:40.510 JupyterHub log:158] 302 GET / -> /hub (@192.168.183.1) 0.86ms
[I 2021-12-01 03:46:40.545 JupyterHub log:158] 302 GET /hub -> /hub/ (@192.168.183.1) 1.03ms
[W 2021-12-01 03:46:40.571 JupyterHub base:242] Invalid or expired cookie token
[I 2021-12-01 03:46:40.574 JupyterHub log:158] 302 GET /hub/ -> /hub/login (@192.168.183.1) 3.96ms
[I 2021-12-01 03:46:40.630 JupyterHub log:158] 200 GET /hub/login (@192.168.183.1) 31.31ms
[I 2021-12-01 03:46:45.414 JupyterHub base:499] User logged in: root
[I 2021-12-01 03:46:45.415 JupyterHub log:158] 302 POST /hub/login?next= -> /user/root/ (root@192.168.183.1) 11.03ms
[I 2021-12-01 03:46:45.451 JupyterHub log:158] 302 GET /user/root/ -> /hub/user/root/ (@192.168.183.1) 0.77ms
[I 2021-12-01 03:46:45.530 JupyterHub spawner:1100] Spawning jupyterhub-singleuser '--ip="192.168.183.148"' --port=46793
Traceback (most recent call last):
File "/usr/local/bin/jupyterhub-singleuser", line 3, in <module>
from jupyterhub.singleuser import main
File "/usr/local/lib/python3.5/site-packages/jupyterhub/singleuser.py", line 34, in <module>
from notebook.notebookapp import (
File "/usr/local/lib/python3.5/site-packages/notebook/notebookapp.py", line 81, in <module>
from .services.kernels.kernelmanager import MappingKernelManager
File "/usr/local/lib/python3.5/site-packages/notebook/services/kernels/kernelmanager.py", line 19, in <module>
from jupyter_client.session import Session
File "/usr/local/lib/python3.5/site-packages/jupyter_client/__init__.py", line 6, in <module>
from .asynchronous import AsyncKernelClient # noqa
File "/usr/local/lib/python3.5/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
from .client import AsyncKernelClient # noqa
File "/usr/local/lib/python3.5/site-packages/jupyter_client/asynchronous/client.py", line 6, in <module>
from jupyter_client.channels import HBChannel
File "/usr/local/lib/python3.5/site-packages/jupyter_client/channels.py", line 47
time_to_dead: float = 1.0
^
SyntaxError: invalid syntax
[W 2021-12-01 03:46:55.506 JupyterHub web:1787] 500 GET /hub/user/root/ (192.168.183.1): Spawner failed to start [status=1]. The logs for root may contain details.
[E 2021-12-01 03:46:55.520 JupyterHub log:150]
"X-Forwarded-Proto": "http",
"Accept-Encoding": "gzip, deflate",
"X-Forwarded-For": "192.168.183.1",
"Upgrade-Insecure-Requests": "1",
"Cookie": "jupyterhub-hub-login=\"2|1:0|10:1638348405|20:jupyterhub-hub-login|44:NTAxYTI1MTFlMjEyNDk0OGEyMzcxMGE4YmQyZTY0MTc=|7226825397d8c04df83eb08b3d6643e6a050f12ac549f65bae0dacffde3b36f6\"; jupyterhub-session-id=7f07873d8ead4f2dbc0684c4e951d7fc",
"Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
"Host": "192.168.183.148:8000",
"Referer": "http://192.168.183.148:8000/hub/login",
"X-Forwarded-Host": "192.168.183.148:8000",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (Khtml, like Gecko) Chrome/99.0.3538.77 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"X-Forwarded-Port": "8000",
"Connection": "close"
[E 2021-12-01 03:46:55.520 JupyterHub log:158] 500 GET /hub/user/root/ (root@192.168.183.1) 10042.81ms
[W 2021-12-01 03:47:14.769 JupyterHub user:510] root's server never showed up at http://192.168.183.148:46793/user/root/ after 30 seconds. Giving up
[E 2021-12-01 03:47:14.805 JupyterHub gen:624] Exception in Future <Task finished coro=<BaseHandler.spawn_single_user.<locals>.finish_user_spawn() done, defined at /usr/local/lib/python3.5/site-packages/jupyterhub/handlers/base.py:619> exception=TimeoutError("Server at http://192.168.183.148:46793/user/root/ didn't respond in 30 seconds",)> after timeout
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/tornado/gen.py", line 618, in error_callback
future.result()
File "/usr/local/lib/python3.5/asyncio/futures.py", line 294, in result
raise self._exception
File "/usr/local/lib/python3.5/asyncio/tasks.py", line 240, in _step
result = coro.send(None)
File "/usr/local/lib/python3.5/site-packages/jupyterhub/handlers/base.py", line 626, in finish_user_spawn
await spawn_future
File "/usr/local/lib/python3.5/site-packages/jupyterhub/user.py", line 528, in spawn
raise e
File "/usr/local/lib/python3.5/site-packages/jupyterhub/user.py", line 502, in spawn
resp = await server.wait_up(http=True, timeout=spawner.http_timeout)
File "/usr/local/lib/python3.5/site-packages/jupyterhub/utils.py", line 197, in wait_for_http_server
timeout=timeout
File "/usr/local/lib/python3.5/site-packages/jupyterhub/utils.py", line 155, in exponential_backoff
raise TimeoutError(fail_message)
TimeoutError: Server at http://192.168.183.148:46793/user/root/ didn't respond in 30 seconds
我在 ubuntu 和 centos 有同样的错误。 他们都安装了python3和python2。
【问题讨论】:
我尝试了两种安装jupyterhub的方法:python3 -m pip install jupyterhub-0.9.4.tar.gz
和python3 setup.py build && python3 setup.py install && python3 -m pip install .
你有 IP 192.168.183.148
吗?也许使用127.0.0.01
或0.0.0.0
欢迎堆栈溢出。感谢您发布完整的堆栈跟踪 - 非常有帮助!
我将其部署在 vmware 而不是 localhost。
【参考方案1】:
查看这个 github 问题:https://github.com/jupyter/notebook/issues/6100
最近发布的 jupyter_client 与 python ≤ 3.5 不兼容。您需要使用更新版本的 python 或将 jupyter_client 固定到 6.1.12 或更早版本。
【讨论】:
"/usr/local/lib/python3.5/site-packages/jupyter_client/channels.py"
引发了错误,所以您使用的是 python 3.5 - 可能在 docker 容器内?
谢谢,但是没用,我试过python3.9.7和notebook 5.0.0,python 3.5.0和notebook 5.6.0。
我部署在vmware,centos和ubuntu都试过了。以上是关于登录 jupyterhub 时,报告 500 : Internal Server Error的主要内容,如果未能解决你的问题,请参考以下文章
关于使用docker部署jupyterhub后jovyan(admin)账号的密码
JupyterHub 未加载给定的外部 IP| K8s |舵
JupyterHub自动HTTPS Letsencrypt:Kubernetes Ingress控制器假证书