Problem with Spawning jupyterhub singleuser from a directory other than /hom/user dir

1,640 views
Skip to first unread message

Anis Chihi

unread,
Mar 16, 2017, 7:24:30 AM3/16/17
to Project Jupyter
Hello Everybody,

So I am pretty new to jupyterhub, and I am trying to set it up. So far so good, I could launch it on a server and have it work. Still I am facing one problem and I could not find a solution anywhere:
When I lauch jupyterhub, it is spawned in /home/user directory. Say I launch it as USER1, I end up in my notebook interface in /home/USER1/tree?. Same happens for USER2. Now I would like to spawn in a different directory. I added c.Spawner.notebook_dir = '/root/code/content-analytics/'  in my config file which I share with you below:


  
c = get_config()
import os
pjoin = os.path.join

runtime_dir = os.path.join('/srv/jupyterhub')
#Configuring ssl and access port
c.JupyterHub.ssl_key = '/etc/letsencrypt/live/blabla/privkey.pem'
c.JupyterHub.ssl_cert = '/etc/letsencrypt/live/blabla/fullchain.pem'
c.JupyterHub.port = 443

# put the JupyterHub cookie secret and state db
# in /var/run/jupyterhub
c.JupyterHub.cookie_secret_file = pjoin(runtime_dir, 'cookie_secret')
c.JupyterHub.db_url = pjoin(runtime_dir, 'jupyterhub.sqlite')

# put the log file in /var/log
c.JupyterHub.extra_log_file = '/var/log/jupyterhub.log'

from oauthenticator.github import LocalGitHubOAuthenticator
c.JupyterHub.authenticator_class = LocalGitHubOAuthenticator
c.LocalGitHubOAuthenticator.create_system_users = True


#Users list
c.Authenticator.add_user_cmd =  ['adduser', '--home', '/home/USERNAME']
c.Authenticator.admin_users={'USER1'}
c.Authenticator.whitelist = {'USER1','USER2'}

#Spawn where
#c.Spawner.notebook_dir = '/root/code/content-analytics/'




Now when I run "jupyterhub -f myconfig, everything works fine. When I click over start my server on the Juypterhub GUI I get this log in my console and 500 internal error on my browser:

Spawning jupyterhub-singleuser --user=USER1 --port=39928 --cookie-name=jupyter-hub-token-adaanis --base-url=/user/USER1 --hub-host= --hub-prefix=/hub/ --hub-api-url=http://127.0.0.1:8081/hub/api --ip=127.0.0.1 --notebook-dir=/root/code/content-analytics/
The Jupyter HTML Notebook.

This launches a Tornado based HTML Notebook Server that serves up an
HTML5/Javascript Notebook client.

Subcommands
-----------

Subcommands are launched as `jupyter-notebook cmd [args]`. For information on
using subcommand 'cmd', do: `jupyter-notebook cmd -h`.

list
    List currently running notebook servers.

Options
-------

Arguments that take values are actually convenience aliases to full
Configurables, whose aliases are listed on the help line. For more information
on full configurables, see '--help-all'.

--no-browser
    Don't open the notebook in a browser after startup.
--script
    DEPRECATED, IGNORED
--disable-user-config
    Disable user-controlled configuration of the notebook server.
--generate-config
    generate default config file
--debug
    set log level to logging.DEBUG (maximize logging output)
--pylab
    DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.
--no-script
    DEPRECATED, IGNORED
--no-mathjax
    Disable MathJax
    
    MathJax is the javascript library Jupyter uses to render math/LaTeX. It is
    very large, so you may want to disable it if you have a slow internet
    connection, or for offline use of the notebook.
    
    When disabled, equations etc. will appear as their untransformed TeX source.
-y
    Answer yes to any questions instead of prompting.
--certfile=<Unicode> (NotebookApp.certfile)
    Default: ''
    The full path to an SSL/TLS certificate file.
--user=<CUnicode> (SingleUserNotebookApp.user)
    Default: ''
--client-ca=<Unicode> (NotebookApp.client_ca)
    Default: ''
    The full path to a certificate authority certificate for SSL/TLS client
    authentication.
--log-level=<Enum> (Application.log_level)
    Default: 30
    Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL')
    Set the log level by value or name.
--hub-api-url=<Unicode> (SingleUserNotebookApp.hub_api_url)
    Default: ''
--hub-host=<Unicode> (SingleUserNotebookApp.hub_host)
    Default: ''
--transport=<CaselessStrEnum> (KernelManager.transport)
    Default: 'tcp'
    Choices: ['tcp', 'ipc']
--browser=<Unicode> (NotebookApp.browser)
    Default: ''
    Specify what command to use to invoke a web browser when opening the
    notebook. If not specified, the default browser will be determined by the
    `webbrowser` standard library module, which allows setting of the BROWSER
    environment variable to override it.
--hub-prefix=<Unicode> (SingleUserNotebookApp.hub_prefix)
    Default: ''
--keyfile=<Unicode> (NotebookApp.keyfile)
    Default: ''
    The full path to a private key file for usage with SSL/TLS.
--pylab=<Unicode> (NotebookApp.pylab)
    Default: 'disabled'
    DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.
--config=<Unicode> (JupyterApp.config_file)
    Default: ''
    Full path of a config file.
--base-url=<Unicode> (SingleUserNotebookApp.base_url)
    Default: '/'
    The base URL for the notebook server.
    Leading and trailing slashes can be omitted, and will automatically be
    added.
--port-retries=<Int> (NotebookApp.port_retries)
    Default: 50
    The number of additional ports to try if the specified port is not
    available.
--notebook-dir=<Unicode> (NotebookApp.notebook_dir)
    Default: ''
    The directory to use for notebooks and kernels.
--cookie-name=<Unicode> (SingleUserNotebookApp.cookie_name)
    Default: ''
--port=<Int> (NotebookApp.port)
    Default: 8888
    The port the notebook server will listen on.
--ip=<Unicode> (NotebookApp.ip)
    Default: 'localhost'
    The IP address the notebook server will listen on.

To see all available configurables, use `--help-all`

Examples
--------

    jupyter notebook                       # start the notebook
    jupyter notebook --certfile=mycert.pem # use SSL/TLS certificate

[C 2017-03-16 11:53:28.662 SingleUserNotebookApp application:90] Bad config encountered during initialization:
[C 2017-03-16 11:53:28.662 SingleUserNotebookApp application:91] No such notebook dir: '/root/code/content-analytics/'


Now the two last lines I think could summarise the error. the dir /root/code/content-analytics/  exists indeed ! I have no Idea what I have been doing wrong. Help me and you will get my eternal recognition :)

Thanks a lot

MinRK

unread,
Mar 16, 2017, 11:49:01 AM3/16/17
to Project Jupyter

It may be a permission issue - it’s likely that /root/ is owned by root and only root-readable, which means subdirectories in there won’t be accessible to other users. Can you try another location, such as one inside their home directories or a public location, such as /home/?

-Min


--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/28cbda76-c1b8-48e3-a9ba-555fa4dbea8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Doherty

unread,
Feb 13, 2018, 6:17:27 PM2/13/18
to Project Jupyter
Did you resolve this?
Reply all
Reply to author
Forward
0 new messages