
[英]Jupyterhub using sudo without root: can't run sudospawner without pw
[英]How to run jupyterhub using sudo. Error: commad not found
我想在我的服务器上运行Jupyterhub
。 我根据说明安装了Jupyterhub
。 我在我的计算机和服务器上都尝试过,两者都在 Ubuntu 16.04 上运行。 当我在没有 sudo 的情况下启动 Jupyterhub 时,我的计算机上一切正常,我可以使用我的用户登录并启动 jupyter 服务器。 但是当我在登录后从服务器运行 jupyterhub 时,我收到错误 500: Internal server error 并且它似乎是因为权限错误
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'
而且我绝对确定我在运行conda install -c conda-forge jupyterhub # installs jupyterhub and proxy
时安装了'configurable-http-proxy'
。
为什么sudo
不识别jupyterhub
? 我怎样才能解决那个PermissionError
?
请指定conda安装configurable-http-proxy的路径。 使用命令从 shell 中查找路径sudo which configurable-http-proxy
确保将此路径添加到 root 用户的 PATH 变量中。 检查使用sudo echo $PATH
如果没有,请将其添加到 PATH 并重试。
试试这个:创建一个服务,并给它 [service] 标签的 root 权限。
也许我这里的 github 会帮助你:
[jupyterhub.service] --> /etc/systemd/system/jupyterhub.service (User=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
传递参数--allow-root
希望有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.