我该如何解决错误:ModuleNotFoundError:没有名为“ jupyterhub”的模块

时间:2020-02-13 00:09:39

标签: python jupyter-notebook centos jupyter jupyter-lab

我正在尝试在CentOS 7上安装和配置JupyterHub,但出现以下情况:

Feb 12 18:28:10 hostname.org jupyterhub: [I 2020-02-12 18:28:10.826 JupyterHub log:174] 302 POST /hub/login?next= -> /hub/spawn (meuser@172.69.69.69) 309.19ms
Feb 12 18:28:11 hostname.org systemd: Started Session c9 of user meuser.
Feb 12 18:28:11 hostname.org jupyterhub: [I 2020-02-12 18:28:11.302 JupyterHub spawner:1417] Spawning jupyterhub-singleuser --ip=10.10.10.10 --port=51914 --NotebookApp.default_url=/tree/home/meuser
Feb 12 18:28:11 hostname.org jupyterhub: Traceback (most recent call last):
Feb 12 18:28:11 hostname.org jupyterhub: File "/usr/local/bin/jupyterhub-singleuser", line 7, in <module>
Feb 12 18:28:11 hostname.org jupyterhub: from jupyterhub.singleuser import main
Feb 12 18:28:11 hostname.org jupyterhub: ModuleNotFoundError: No module named 'jupyterhub'
Feb 12 18:28:11 hostname.org jupyterhub: [I 2020-02-12 18:28:11.986 JupyterHub log:174] 302 GET /hub/spawn -> /hub/spawn-pending/meuser (meuser@172.69.69.69) 1016.77ms
Feb 12 18:28:12 hostname.org jupyterhub: [I 2020-02-12 18:28:12.080 JupyterHub pages:347] meuser is pending spawn
Feb 12 18:28:12 hostname.org jupyterhub: [I 2020-02-12 18:28:12.087 JupyterHub log:174] 200 GET /hub/spawn-pending/meuser (meuser@172.69.69.69) 15.77ms
Feb 12 18:28:20 hostname.org jupyterhub: ERROR:asyncio:Task exception was never retrieved
Feb 12 18:28:20 hostname.org jupyterhub: future: <Task finished coro=<BaseHandler.spawn_single_user() done, defined at /opt/jupyterhub/lib64/python3.6/site-packages/jupyterhub/handlers/base.py:741> exception=HTTPError()>
Feb 12 18:28:20 hostname.org jupyterhub: Traceback (most recent call last):
Feb 12 18:28:20 hostname.org jupyterhub: File "/opt/jupyterhub/lib64/python3.6/site-packages/jupyterhub/handlers/base.py", line 939, in spawn_single_user
Feb 12 18:28:20 hostname.org jupyterhub: timedelta(seconds=self.slow_spawn_timeout), finish_spawn_future
Feb 12 18:28:20 hostname.org jupyterhub: tornado.util.TimeoutError: Timeout
Feb 12 18:28:20 hostname.org jupyterhub: During handling of the above exception, another exception occurred:
Feb 12 18:28:20 hostname.org jupyterhub: Traceback (most recent call last):
Feb 12 18:28:20 hostname.org jupyterhub: File "/opt/jupyterhub/lib64/python3.6/site-packages/jupyterhub/handlers/base.py", line 972, in spawn_single_user
Feb 12 18:28:20 hostname.org jupyterhub: % (status, spawner._log_name),
Feb 12 18:28:20 hostname.org jupyterhub: tornado.web.HTTPError: HTTP 500: Internal Server Error (Spawner failed to start [status=1]. The logs for meuser may contain details.)
Feb 12 18:28:40 hostname.org jupyterhub: [W 2020-02-12 18:28:40.341 JupyterHub user:692] meuser's server never showed up at http://10.10.10.10:51914/user/meuser/ after 30 seconds. Giving up
Feb 12 18:28:40 hostname.org jupyterhub: [E 2020-02-12 18:28:40.390 JupyterHub gen:599] Exception in Future <Task finished coro=<BaseHandler.spawn_single_user.<locals>.finish_user_spawn() done, defined at /opt/jupyterhub/lib64/python3.6/site-packages/jupyterhub/handlers/base.py:845> exception=TimeoutError("Server at http://10.10.10.10:51914/user/meuser/ didn't respond in 30 seconds",)> after timeout

我按照以下说明在CentOS 7上安装JupyterHub:Install Jupyter不使用Conda,而是使用pip和NPM。此处报告了类似的问题:GitHub 2276,而我遇到的唯一冲突是运行报告head -n 1 $(which jupyterhub)的命令#!/bin/python3以及运行命令which -a python3时得到的冲突/usr/bin/python3。这是问题吗?如果是这样,我该如何解决?

1 个答案:

答案 0 :(得分:0)

出现此错误是因为site-packages目录上的权限为700。解决此问题的方法是将所有用户的读取和执行权限递归添加到/opt/jupyterhub/lib64/python3.6/site-packages目录。