Jupyterhub_config.py

I can start jupyterhub.service successfully with all default setting of jupyterhub_config.py. Once i add config to jupyterhub_config.py , service fail to start normally.

dy3:/home/jupyter$ service jupyterhub status
● jupyterhub.service - JupyterHub
Loaded: loaded (/etc/systemd/system/jupyterhub.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2024-07-11 02:05:58 UTC; 34s ago
Main PID: 9997 (jupyterhub)
Tasks: 10 (limit: 38253)
Memory: 81.7M
CPU: 1.878s
CGroup: /system.slice/jupyterhub.service
├─ 9997 /usr/bin/python3 /usr/local/bin/jupyterhub -f /home/jupyter/jupyterhub_config.py
└─10002 node /bin/configurable-http-proxy --ip “” --port 8000 --api-ip 127.0.0.1 --api-port 8001 --error-target http://127.0.0.1:8081/hub/error --log-level info

Jul 11 02:06:10 study3 jupyterhub[10002]: (Use node --trace-deprecation ... to show where the warning was created)
Jul 11 02:06:10 study3 jupyterhub[9997]: [W 2024-07-11 02:06:10.306 JupyterHub auth:705] User ‘ieda’ not allowed.
Jul 11 02:06:10 study3 jupyterhub[9997]: [W 2024-07-11 02:06:10.307 JupyterHub base:979] Failed login for ieda
Jul 11 02:06:10 study3 jupyterhub[9997]: [I 2024-07-11 02:06:10.365 JupyterHub log:192] 200 POST /hub/login?next=%2Fhub%2F (@::ffff:143.89.21.120) 78.18ms
Jul 11 02:06:18 study3 jupyterhub[9997]: [W 2024-07-11 02:06:18.431 JupyterHub auth:705] User ‘ieda’ not allowed.
Jul 11 02:06:18 study3 jupyterhub[9997]: [W 2024-07-11 02:06:18.431 JupyterHub base:979] Failed login for ieda
Jul 11 02:06:18 study3 jupyterhub[9997]: [I 2024-07-11 02:06:18.434 JupyterHub log:192] 200 POST /hub/login?next=%2Fhub%2F (@::ffff:143.89.21.120) 18.10ms
Jul 11 02:06:24 study3 jupyterhub[9997]: [W 2024-07-11 02:06:24.012 JupyterHub auth:705] User ‘ieda’ not allowed.
Jul 11 02:06:24 study3 jupyterhub[9997]: [W 2024-07-11 02:06:24.012 JupyterHub base:979] Failed login for ieda
Jul 11 02:06:24 study3 jupyterhub[9997]: [I 2024-07-11 02:06:24.015 JupyterHub log:192] 200 POST /hub/login?next=%2Fhub%2F (@::ffff:143.89.21.120) 31.71ms

just remove # for Line 12,
c.Application.log_datefmt = ‘%Y-%m-%d %H:%M:%S’

y3:/home/jupyter$ service jupyterhub status
× jupyterhub.service - JupyterHub
Loaded: loaded (/etc/systemd/system/jupyterhub.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2024-07-11 03:05:09 UTC; 11s ago
Process: 10296 ExecStart=/usr/local/bin/jupyterhub -f /home/jupyter/jupyterhub_config.py (code=exited, status=1/FAILURE)
Main PID: 10296 (code=exited, status=1/FAILURE)
CPU: 1.071s

Jul 11 03:05:09 study3 jupyterhub[10296]: self._read_file_as_dict()
Jul 11 03:05:09 study3 jupyterhub[10296]: File “/usr/local/lib/python3.10/dist-packages/traitlets/config/loader.py”, line 655, in _read_file_as_dict
Jul 11 03:05:09 study3 jupyterhub[10296]: exec(compile(f.read(), conf_filename, “exec”), namespace, namespace) # noqa: S102
Jul 11 03:05:09 study3 jupyterhub[10296]: File “/home/jupyter/jupyterhub_config.py”, line 12
Jul 11 03:05:09 study3 jupyterhub[10296]: c.Application.log_datefmt = ‘%Y-%m-%d %H:%M:%S’
Jul 11 03:05:09 study3 jupyterhub[10296]: IndentationError: unexpected indent
Jul 11 03:05:09 study3 jupyterhub[10296]:
Jul 11 03:05:09 study3 systemd[1]: jupyterhub.service: Main process exited, code=exited, status=1/FAILURE
Jul 11 03:05:09 study3 systemd[1]: jupyterhub.service: Failed with result ‘exit-code’.
Jul 11 03:05:09 study3 systemd[1]: jupyterhub.service: Consumed 1.071s CPU time.

It sounds like your config file is badly formatted, or there’s a syntax error (which may be on another line).

Thanks manics. Problem solved after removed the space before c.