3

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?

Community
  • 1
  • 1
Mehdi
  • 1,260
  • 2
  • 16
  • 36

3 Answers3

1

Please specify the path at which configurable-http-proxy is installed by conda. Find path from shell using command
sudo which configurable-http-proxy

Make sure that this path is added to PATH variable of root user. Check using
sudo echo $PATH

If not please add it to PATH and try again.

Sangram Gaikwad
  • 764
  • 11
  • 21
  • I think you are in a right way, but when I want to add Conda to $PATH, i get `sudo: export: command not found`. How can I do that? – Mehdi May 02 '18 at 18:29
  • 2
    Try adding ``c.ConfigurableHTTPProxy.command = '/anaconda3/bin/configurable-http-proxy' ``in jupyterhub_config.py (jc.py in your case) file. Assuming that path of configurable-http-proxy is ``/anaconda3/bin/configurable-http-proxy`` – Sangram Gaikwad May 03 '18 at 05:31
1

Try this: Create a service, and give it root permissions on [service] tag.

Maybe my github here will help you:

Github/Jupyter

[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
Nouvellie
  • 533
  • 4
  • 9
-1

pass the parameter --allow-root

Hope that helps

maswadkar
  • 1,502
  • 1
  • 13
  • 23