jupyterlab-hub icon indicating copy to clipboard operation
jupyterlab-hub copied to clipboard

jupyterlab-hub include page_config.json check and provide help finding JupyterHub

Open NumesSanguis opened this issue 6 years ago • 1 comments
trafficstars

Describe the bug After installing jupyterlab-hub, trying to set page_config.json, removing it, JupyterHub returns a 404 : Not Found. Terminal output states a json.decoder.JSONDecodeError: Expecting ',' delimiter: line 2 column 38 (char 39) --> Realize JSON is wrongly formatted, because comments not allowed just before posting issue --> Still don't know correct path to JupyterHub

To Reproduce Steps to reproduce the behavior: Note:

  • JupyterHub is installed through system-wide Miniconda in /opt/miniconda3 (system user account) with:
    • conda install -c conda-forge jupyterhub
    • conda install jupyterlab
  • JupyterHub resides in /etc/jupyterhub/
  1. Install jupyterlab-hub: jupyter labextension install @jupyterlab/hub-extension
  2. Create the page_config.json file at: /opt/miniconda3/share/jupyter/lab/settings/page_config.json
  3. Insert
{
    "hub_prefix": "/etc/jupyterhub"
}
  1. Save and exit
  2. Start JupyterHub:
cd /etc/jupyterhub
jupyterhub -f /etc/jupyterhub/jupyterhub_config.py --JupyterHub.spawner_class=sudospawner.SudoSpawner
  1. Find Configuration Panel button in menu and click it
  2. 404 Page not found error:
[I 2019-05-31 10:33:28.097 JupyterHub log:174] 302 GET /etc/jupyterhub/home -> /hub/etc/jupyterhub/home (@127.0.0.1) 0.93ms
[W 2019-05-31 10:33:28.158 JupyterHub log:174] 404 GET /hub/etc/jupyterhub/home (*user*@127.0.0.1) 14.06ms
  1. rm /opt/miniconda3/share/jupyter/lab/settings/page_config.json
  2. JupyterHub lab starts again, but no Configuration Panel menu entree
  3. Create /opt/miniconda3/share/jupyter/lab/settings/page_config.json again, but with
{
    "hub_prefix": "/etc"  # path to JupyterHub
}
  1. Start JupyterHub again
  2. 404 error
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 2 column 38 (char 39)
  1. Remove page_config.json and it works again.
  2. About to submit issue, realize in Preview that JSON is wrongly formatted and # comments are not allowed.
  3. Still don't know the correct JupyterHub path. Not working:
    • /etc
    • /etc/jupyterhub
    • /opt/miniconda3/bin/jupyter

Expected behavior

  • A clear error messages stating that page_config.json is broken. Instead it breaks the whole JupyterHub.
  • A message that hub_prefix is incorrectly set and jupyterlab-hub won't work.

Suggestions

  • Improve README.md to give clearer instructions. E.g. how to find your JupyterHub sub-directory.
  • Some automatic page_config.json creation with the correct path set / support for how to set it, when clicked on Hub --> Controlpanel when JupyterHub cannot be found

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-50-generic x86_64)
  • Browser Firefox Quantum 67.0 (64-bit)
  • JupyterLab 1.0.0

Additional context Add any other context about the problem here.

If available, please include the following details:

Troubleshoot Output
jupyter troubleshoot
$PATH:
	/opt/miniconda3/bin
	/opt/miniconda3/bin
	/opt/miniconda3/condabin
	/usr/local/sbin
	/usr/local/bin
	/usr/sbin
	/usr/bin
	/sbin
	/bin
	/usr/games
	/usr/local/games

sys.path: /opt/miniconda3/bin /opt/miniconda3/lib/python37.zip /opt/miniconda3/lib/python3.7 /opt/miniconda3/lib/python3.7/lib-dynload /opt/miniconda3/lib/python3.7/site-packages

sys.executable: /opt/miniconda3/bin/python

sys.version: 3.7.3 (default, Mar 27 2019, 22:11:17) [GCC 7.3.0]

platform.platform(): Linux-4.15.0-50-generic-x86_64-with-debian-buster-sid

which -a jupyter: /opt/miniconda3/bin/jupyter /opt/miniconda3/bin/jupyter

pip list: Package Version ----------------- -------- alembic 1.0.10
asn1crypto 0.24.0
async-generator 1.10
attrs 19.1.0
backcall 0.1.0
bleach 3.1.0
blinker 1.4
certifi 2019.3.9 certipy 0.1.3
cffi 1.12.2
chardet 3.0.4
conda 4.6.14
cryptography 2.6.1
decorator 4.4.0
defusedxml 0.6.0
entrypoints 0.3
idna 2.8
ipykernel 5.1.0
ipython 7.5.0
ipython-genutils 0.2.0
jedi 0.13.3
Jinja2 2.10.1
jsonschema 3.0.1
jupyter-client 5.2.4
jupyter-core 4.4.0
jupyterhub 1.0.0
jupyterlab 0.35.5
jupyterlab-server 0.2.0
Mako 1.0.10
MarkupSafe 1.1.1
mistune 0.8.4
nbconvert 5.5.0
nbformat 4.4.0
notebook 5.7.8
oauthlib 3.0.1
pamela 1.0.0
pandocfilters 1.4.2
parso 0.4.0
pexpect 4.7.0
pickleshare 0.7.5
pip 19.0.3
prometheus-client 0.6.0
prompt-toolkit 2.0.9
ptyprocess 0.6.0
pycosat 0.6.3
pycparser 2.19
pycurl 7.43.0.2 Pygments 2.4.0
PyJWT 1.7.1
pyOpenSSL 19.0.0
pyrsistent 0.14.11 PySocks 1.6.8
python-dateutil 2.8.0
python-editor 1.0.4
pyzmq 18.0.0
requests 2.21.0
ruamel-yaml 0.15.46 Send2Trash 1.5.0
setuptools 41.0.0
six 1.12.0
SQLAlchemy 1.3.4
sudospawner 0.5.2
terminado 0.8.2
testpath 0.4.2
tornado 6.0.2
traitlets 4.3.2
urllib3 1.24.1
wcwidth 0.1.7
webencodings 0.5.1
wheel 0.33.1

conda list: # packages in environment at /opt/miniconda3: # # Name Version Build Channel alembic 1.0.10 py_0 conda-forge asn1crypto 0.24.0 py37_0
async_generator 1.10 py_0 conda-forge attrs 19.1.0 py37_1
backcall 0.1.0 py37_0
bleach 3.1.0 py37_0
blinker 1.4 py_1 conda-forge ca-certificates 2019.1.23 0
certifi 2019.3.9 py37_0
certipy 0.1.3 py_0 conda-forge cffi 1.12.2 py37h2e261b9_1
chardet 3.0.4 py37_1
conda 4.6.14 py37_0
configurable-http-proxy 1.3.0 0 conda-forge cryptography 2.6.1 py37h1ba5d50_0
decorator 4.4.0 py_0 conda-forge defusedxml 0.6.0 py_0
entrypoints 0.3 py37_1000 conda-forge gmp 6.1.2 h6c8ec71_1
idna 2.8 py37_0
ipykernel 5.1.0 py37h39e3cac_0
ipython 7.5.0 py37h39e3cac_0
ipython_genutils 0.2.0 py_1 conda-forge jedi 0.13.3 py37_0
jinja2 2.10.1 py_0 conda-forge jsonschema 3.0.1 py37_0
jupyter_client 5.2.4 py37_0
jupyter_core 4.4.0 py37_0
jupyterhub 1.0.0 py37_0 conda-forge jupyterlab 0.35.5 py37hf63ae98_0
jupyterlab_server 0.2.0 py37_0
krb5 1.16.1 h173b8e3_7
libcurl 7.64.1 h20c2e04_0
libedit 3.1.20181209 hc058e9b_0
libffi 3.2.1 hd88cf55_4
libgcc-ng 8.2.0 hdf63c60_1
libsodium 1.0.16 h1bed415_0
libssh2 1.8.2 h22169c7_2 conda-forge libstdcxx-ng 8.2.0 hdf63c60_1
mako 1.0.10 py_0 conda-forge markupsafe 1.1.1 py37h14c3975_0 conda-forge mistune 0.8.4 py37h7b6447c_0
nbconvert 5.5.0 py_0
nbformat 4.4.0 py37_0
ncurses 6.1 he6710b0_1
nodejs 11.14.0 he1b5a44_1 conda-forge notebook 5.7.8 py37_0
oauthlib 3.0.1 py_0 conda-forge openssl 1.1.1b h7b6447c_1
pamela 1.0.0 py_0 conda-forge pandoc 2.2.3.2 0
pandocfilters 1.4.2 py37_1
parso 0.4.0 py_0
pexpect 4.7.0 py37_0
pickleshare 0.7.5 py37_0
pip 19.0.3 py37_0
prometheus_client 0.6.0 py_0 conda-forge prompt_toolkit 2.0.9 py37_0
ptyprocess 0.6.0 py37_0
pycosat 0.6.3 py37h14c3975_0
pycparser 2.19 py37_0
pycurl 7.43.0.2 py37h16ce93b_0 conda-forge pygments 2.4.0 py_0
pyjwt 1.7.1 py_0 conda-forge pyopenssl 19.0.0 py37_0
pyrsistent 0.14.11 py37h7b6447c_0
pysocks 1.6.8 py37_0
python 3.7.3 h0371630_0
python-dateutil 2.8.0 py_0 conda-forge python-editor 1.0.4 py_0 conda-forge pyzmq 18.0.0 py37he6710b0_0
readline 7.0 h7b6447c_5
requests 2.21.0 py37_0
ruamel_yaml 0.15.46 py37h14c3975_0
send2trash 1.5.0 py37_0
setuptools 41.0.0 py37_0
six 1.12.0 py37_0
sqlalchemy 1.3.4 py37h516909a_0 conda-forge sqlite 3.27.2 h7b6447c_0
sudospawner 0.5.2 pypi_0 pypi terminado 0.8.2 py37_0
testpath 0.4.2 py37_0
tk 8.6.8 hbc83047_0
tornado 6.0.2 py37h516909a_0 conda-forge traitlets 4.3.2 py37_1000 conda-forge urllib3 1.24.1 py37_0
wcwidth 0.1.7 py37_0
webencodings 0.5.1 py37_1
wheel 0.33.1 py37_0
xz 5.2.4 h14c3975_4
yaml 0.1.7 had09818_2
zeromq 4.3.1 he6710b0_3
zlib 1.2.11 h7b6447c_3

Command Line Output
jupyterhub -f /etc/jupyterhub/jupyterhub_config.py --JupyterHub.spawner_class=sudospawner.SudoSpawner
[I 2019-05-31 10:46:44.416 JupyterHub app:2120] Using Authenticator: jupyterhub.auth.PAMAuthenticator-1.0.0
[I 2019-05-31 10:46:44.416 JupyterHub app:2120] Using Spawner: sudospawner.spawner.SudoSpawner
[I 2019-05-31 10:46:44.418 JupyterHub app:1257] Loading cookie_secret from /srv/jupyterhub/jupyterhub_cookie_secret
[I 2019-05-31 10:46:44.429 JupyterHub proxy:460] Generating new CONFIGPROXY_AUTH_TOKEN
[W 2019-05-31 10:46:44.430 JupyterHub app:1532] No admin users, admin interface will be unavailable.
[W 2019-05-31 10:46:44.430 JupyterHub app:1534] Add any administrative users to `c.Authenticator.admin_users` in config.
[I 2019-05-31 10:46:44.430 JupyterHub app:1563] Not using whitelist. Any authenticated user will be allowed.
[I 2019-05-31 10:46:44.454 JupyterHub app:2337] Hub API listening on http://127.0.0.1:8081/hub/
[W 2019-05-31 10:46:44.454 JupyterHub proxy:642] Running JupyterHub without SSL.  I hope there is SSL termination happening somewhere else...
[I 2019-05-31 10:46:44.454 JupyterHub proxy:645] Starting proxy @ http://192.168.11.61:8080
10:46:44.823 - info: [ConfigProxy] Proxying http://192.168.11.61:8080 to (no default)
10:46:44.824 - info: [ConfigProxy] Proxy API at http://127.0.0.1:8001/api/routes
[I 2019-05-31 10:46:45.062 JupyterHub proxy:319] Checking routes
[I 2019-05-31 10:46:45.062 JupyterHub proxy:399] Adding default route for Hub: / => http://127.0.0.1:8081
[I 2019-05-31 10:46:45.064 JupyterHub app:2422] JupyterHub is now running at http://192.168.11.61:8080
[I 2019-05-31 10:46:49.933 JupyterHub log:174] 302 GET / -> /hub/ (@127.0.0.1) 0.99ms
[I 2019-05-31 10:46:49.977 JupyterHub log:174] 302 GET /hub/ -> /hub/spawn (*user*@127.0.0.1) 9.68ms
sh: 1: cannot create /run/motd.dynamic.new: Permission denied
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-50-generic x86_64)
  • Documentation: https://help.ubuntu.com

  • Management: https://landscape.canonical.com

  • Support: https://ubuntu.com/advantage

  • Ubuntu's Kubernetes 1.14 distributions can bypass Docker and use containerd directly, see https://bit.ly/ubuntu-containerd or try it now with

    snap install microk8s --classic

  • Canonical Livepatch is available for installation.

    • Reduce system reboots and improve kernel security. Activate at: https://ubuntu.com/livepatch

17 packages can be updated. 13 updates are security updates.

The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.

The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.

[I 190531 10:46:50 mediator:89] Spawning /opt/miniconda3/bin/jupyterhub-singleuser --port=45747 --NotebookApp.default_url=/lab [I 2019-05-31 10:46:51.014 JupyterHub log:174] 302 GET /hub/spawn -> /hub/spawn-pending/user (user@127.0.0.1) 1007.01ms [I 2019-05-31 10:46:51.051 JupyterHub pages:303] user is pending spawn [I 2019-05-31 10:46:51.071 JupyterHub log:174] 200 GET /hub/spawn-pending/user (user@127.0.0.1) 26.98ms [W 2019-05-31 10:46:51.317 SingleUserNotebookApp notebookapp:1580] Error loading server extension jupyterlab Traceback (most recent call last): File "/opt/miniconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 1575, in init_server_extensions func(self) File "/opt/miniconda3/lib/python3.7/site-packages/jupyterlab/extension.py", line 115, in load_jupyter_server_extension config = load_config(nbapp) File "/opt/miniconda3/lib/python3.7/site-packages/jupyterlab/extension.py", line 41, in load_config info = get_app_info(app_dir) File "/opt/miniconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 280, in get_app_info handler = _AppHandler(app_dir, logger) File "/opt/miniconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 386, in init self.info = self._get_app_info() File "/opt/miniconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 810, in _get_app_info page_config = self._read_page_config() File "/opt/miniconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 1215, in _read_page_config return json.load(fid) File "/opt/miniconda3/lib/python3.7/json/init.py", line 296, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "/opt/miniconda3/lib/python3.7/json/init.py", line 348, in loads return _default_decoder.decode(s) File "/opt/miniconda3/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/opt/miniconda3/lib/python3.7/json/decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting ',' delimiter: line 2 column 38 (char 39) [I 2019-05-31 10:46:51.318 SingleUserNotebookApp singleuser:561] Starting jupyterhub-singleuser server version 1.0.0 [I 2019-05-31 10:46:51.321 JupyterHub log:174] 200 GET /hub/api (@127.0.0.1) 0.64ms [I 2019-05-31 10:46:51.321 SingleUserNotebookApp notebookapp:1774] Serving notebooks from local directory: /home/user [I 2019-05-31 10:46:51.321 SingleUserNotebookApp notebookapp:1774] The Jupyter Notebook is running at: [I 2019-05-31 10:46:51.321 SingleUserNotebookApp notebookapp:1774] http://127.0.0.1:45747/user/user/ [I 2019-05-31 10:46:51.321 SingleUserNotebookApp notebookapp:1775] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [I 2019-05-31 10:46:51.324 SingleUserNotebookApp singleuser:542] Updating Hub with activity every 300 seconds [I 2019-05-31 10:46:51.339 JupyterHub log:174] 200 POST /hub/api/users/user/activity (user@127.0.0.1) 13.84ms

[I 2019-05-31 10:46:51.347 JupyterHub base:810] User user took 1.334 seconds to start [I 2019-05-31 10:46:51.347 JupyterHub proxy:261] Adding user user to proxy /user/user/ => http://127.0.0.1:45747 [I 2019-05-31 10:46:51.347 SingleUserNotebookApp log:174] 302 GET /user/user/ -> /user/user/lab? (@127.0.0.1) 0.57ms [I 2019-05-31 10:46:51.349 JupyterHub users:606] Server user is ready [I 2019-05-31 10:46:51.349 JupyterHub log:174] 200 GET /hub/api/users/user/server/progress (user@127.0.0.1) 123.51ms [I 2019-05-31 10:46:51.392 JupyterHub log:174] 302 GET /hub/spawn-pending/user -> /user/user/ (user@127.0.0.1) 5.82ms [I 2019-05-31 10:46:51.434 SingleUserNotebookApp log:174] 302 GET /user/user/ -> /user/user/lab? (@127.0.0.1) 0.50ms [W 2019-05-31 10:46:51.489 SingleUserNotebookApp log:174] 404 GET /user/user/lab? (@127.0.0.1) 23.03ms

Browser Output
# After logging in

404 : Not Found You are requesting a page that does not exist!

NumesSanguis avatar May 31 '19 03:05 NumesSanguis

Hi @NumesSanguis, the hub_prefix is a property of the SingleUserNotebookApp [1]. You are meant to override it using standard Jupyter config [2]. I'm not sure about the correct value for that property, that question is better asked on the JupyterHub discourse.

[1] https://github.com/jupyterlab/jupyterlab/blob/master/jupyterlab/labhubapp.py#L25 [2] https://jupyter-notebook.readthedocs.io/en/stable/config_overview.html

cf https://github.com/jupyterlab/jupyterlab/issues/6428, where we're absorbing this extension into JupyterLab itself.

blink1073 avatar May 31 '19 16:05 blink1073