2

我想Jupyterhub在我的服务器上运行。我是按照说明Jupyterhub安装的。我从我的计算机和在 Ubuntu 16.04 上运行的服务器上都尝试了它。当我在没有 sudo 的情况下启动 Jupyterhub 时,我的计算机上一切正常,我可以使用我的用户登录并启动 jupyter 服务器。但是,当我登录后从服务器运行 jupyterhub 时,我收到错误 500:内部服务器错误,这似乎是因为权限错误

PermissionError: [Errno 13] Permission denied

然后我尝试使用 sudo 运行 jupyterhub:我的配置文件sudo jupyterhub -f jc.py 在哪里。jc.py我看到了这个错误:

sudo: jupyterhub: command not found

第一步,我不知道为什么 sudo 无法识别 jupyterhub 命令,正如指南所说,我使用 conda 安装 jupyterhub。

为了解决这个问题,我从路径运行 jupyterhub:

sudo anaconda3/bin/jupyterhub -f jc.py 这次我收到了这个错误:

FileNotFoundError: [Errno 2] No such file or directory: 'configurable-http-proxy'

而且我绝对确定我 'configurable-http-proxy'在运行时安装了conda install -c conda-forge jupyterhub # installs jupyterhub and proxy.

为什么sudo不认识jupyterhub?我该如何解决PermissionError

4

3 回答 3

1

试试这个:创建一个服务,并给它 [service] 标签的 root 权限。

也许我的 github 会帮助你:

Github/Jupyter

[jupyterhub.service] --> /etc/systemd/system/jupyterhub.service(用户=root)

[Unit]
Description=Jupyterhub Service

[Service]
Environment="PATH=/opt/anaconda3/envs/<jupyterbase>/bin:/opt/anaconda3/bin:/opt/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
ExecStart=/opt/anaconda3/envs/<jupyterbase>/bin/jupyterhub
WorkingDirectory=/opt/<user>-jupyterhub
Restart=on-failure
User=root

[Install]
WantedBy=multi-user.target

然后:

$ sudo systemctl start jupyterhub.service
于 2020-01-21T02:03:23.480 回答
1

请指定 conda 安装可配置 http-proxy 的路径。使用命令从 shell 中查找路径
sudo which configurable-http-proxy

确保将此路径添加到 root 用户的 PATH 变量中。检查使用
sudo echo $PATH

如果没有,请将其添加到 PATH 并重试。

于 2018-05-02T07:52:18.877 回答
0

传递参数--allow-root

希望有帮助

于 2018-05-02T08:59:30.250 回答