我想在我的服务器上运行Jupyterhub
。我从the instruction安装了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
?
答案 0 :(得分:1)
尝试以下操作:创建一个服务,并赋予它对[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
答案 1 :(得分:0)
请指定conda安装configurable-http-proxy的路径。
使用命令
从shell查找路径
var s = "foo,#REF!,bar!,baz,qux!";
var rx = /(?:^|,)(?!#REF!)([^!,]{1,99})!/g, m, res=[];
while (m=rx.exec(s)) {
res.push(m[1]);
}
console.log(res);
确保将此路径添加到root用户的PATH变量中。
检查使用
sudo which configurable-http-proxy
如果没有,请将其添加到PATH并重试。
答案 2 :(得分:0)
传递参数--allow-root
希望有所帮助