I want to run Jupyterhub
on my server. I installed Jupyterhub
from the instruction . I try it from both my computer and the server where both running on Ubuntu 16.04. When I start Jupyterhub without sudo, everything is Ok on my computer, and I can log in with my user and It starts the jupyter server. But when I run jupyterhub from the server after login I get error 500: Internal server error and it seems its because of permission error
PermissionError: [Errno 13] Permission denied
Then I tried to run jupyterhub using sudo: sudo jupyterhub -f jc.py
where jc.py
is my configuration file. And I see this error:
sudo: jupyterhub: command not found
At first step, I don't know why sudo doesn't recognize jupyterhub command, As the guide says, I install jupyterhub using conda.
To solve that problem I run jupyterhub from the path:
sudo anaconda3/bin/jupyterhub -f jc.py
and this time I get this error:
FileNotFoundError: [Errno 2] No such file or directory: 'configurable-http-proxy'
And absolutely I'm sure that I installed 'configurable-http-proxy'
when I run conda install -c conda-forge jupyterhub # installs jupyterhub and proxy
.
Why sudo
doesn't recognize jupyterhub
? How can I solve that PermissionError
?
Please specify the path at which configurable-http-proxy is installed by conda. Find path from shell using commandsudo which configurable-http-proxy
Make sure that this path is added to PATH variable of root user. Check usingsudo echo $PATH
If not please add it to PATH and try again.
Try this: Create a service, and give it root permissions on [service] tag.
Maybe my github here will help you:
[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
Then:
$ sudo systemctl start jupyterhub.service
pass the parameter --allow-root
Hope that helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.