How to redirect to JupyterLab after launching server in 5.0.0

after launching the server, showing “A Jupyter Server is running.”, tried adding “c.Spawner.default_url = ‘/lab’”, but showing a 404 error.
There is no such issue as ‘A Jupyter Server is running.’ in version 2.3.1, which was installed with Python 3.6.8. I researched the issue on https://jupyterhub.readthedocs.io/ and discourse, but couldn’t find any information. Are there any changes regarding this in version 5.0.0?


Have you installed JupyterLab in the singleuser environment?

Can you show us pip list, your full logs, and your JupyterHub configuration?

here is the pip list and Jupyterhub config
jupyterhub_config

[ccadmin@cc_cn ~]$ sudo /usr/local/bin/python3.8 -m pip list
Package                      Version
---------------------------- --------------
alembic                      1.13.2
annotated-types              0.7.0
anyio                        4.4.0
argon2-cffi                  23.1.0
argon2-cffi-bindings         21.2.0
arrow                        1.3.0
asttokens                    2.4.1
async-generator              1.10
async-lru                    2.0.4
attrs                        23.2.0
Babel                        2.15.0
backcall                     0.2.0
beautifulsoup4               4.12.3
bleach                       6.1.0
certifi                      2024.6.2
certipy                      0.1.3
cffi                         1.16.0
charset-normalizer           3.3.2
comm                         0.2.2
cryptography                 42.0.8
debugpy                      1.8.1
decorator                    5.1.1
defusedxml                   0.7.1
entrypoints                  0.4
exceptiongroup               1.2.1
executing                    2.0.1
fastjsonschema               2.20.0
fqdn                         1.5.1
greenlet                     3.0.3
h11                          0.14.0
httpcore                     1.0.5
httpx                        0.27.0
idna                         3.7
importlib_metadata           8.0.0
importlib_resources          6.4.0
ipykernel                    6.29.4
ipython                      8.12.3
ipython-genutils             0.2.0
isoduration                  20.11.0
jedi                         0.19.1
Jinja2                       3.1.4
json5                        0.9.25
jsonpointer                  3.0.0
jsonschema                   4.22.0
jsonschema-specifications    2023.12.1
jupyter_client               7.4.9
jupyter_core                 5.7.2
jupyter-events               0.10.0
jupyter-lsp                  2.2.5
jupyter_server               2.14.1
jupyter_server_terminals     0.5.3
jupyterhub                   5.0.0
jupyterhub-ldapauthenticator 1.3.2
jupyterlab                   4.2.2
jupyterlab_pygments          0.3.0
jupyterlab_server            2.27.2
ldap3                        2.9.1
Mako                         1.3.5
MarkupSafe                   2.1.5
matplotlib-inline            0.1.7
mistune                      3.0.2
nbclassic                    1.1.0
nbclient                     0.10.0
nbconvert                    7.16.4
nbformat                     5.10.4
nest-asyncio                 1.6.0
notebook                     7.2.1
notebook_shim                0.2.4
oauthlib                     3.2.2
overrides                    7.7.0
packaging                    24.1
pamela                       1.1.0
pandocfilters                1.5.1
parso                        0.8.4
pexpect                      4.9.0
pickleshare                  0.7.5
pip                          21.3.1
pkgutil_resolve_name         1.3.10
platformdirs                 4.2.2
prometheus_client            0.20.0
prompt_toolkit               3.0.47
psutil                       6.0.0
ptyprocess                   0.7.0
pure-eval                    0.2.2
pyasn1                       0.6.0
pycparser                    2.22
pydantic                     2.7.4
pydantic_core                2.18.4
Pygments                     2.18.0
pyOpenSSL                    24.1.0
python-dateutil              2.9.0.post0
python-json-logger           2.0.7
pytz                         2024.1
PyYAML                       6.0.1
pyzmq                        26.0.3
referencing                  0.35.1
requests                     2.32.3
rfc3339-validator            0.1.4
rfc3986-validator            0.1.1
rpds-py                      0.18.1
Send2Trash                   1.8.3
setuptools                   41.2.0
six                          1.16.0
sniffio                      1.3.1
soupsieve                    2.5
SQLAlchemy                   2.0.31
stack-data                   0.6.3
terminado                    0.18.1
tinycss2                     1.3.0
tomli                        2.0.1
tornado                      6.4.1
traitlets                    5.14.3
types-python-dateutil        2.9.0.20240316
typing_extensions            4.12.2
uri-template                 1.3.0
urllib3                      1.26.16
wcwidth                      0.2.13
webcolors                    24.6.0
webencodings                 0.5.1
websocket-client             1.8.0
zipp                         3.19.2

Thanks. Can you turn on debug logging, and show us your full logs, especially for the singleuser server?

sorry, seems unable to attach file so have to attach content directly

I have added /lab and specified Spawner.cmd command to startup Jupyterlab,now is another timeout issue now.
1

[I 2024-07-09 20:45:40.564 JupyterHub log:192] 200 GET /hub/home (ccadmin@::ffff:172.16.25.18) 48.34ms
[I 2024-07-09 20:46:05.804 JupyterHub provider:661] Creating oauth client jupyterhub-user-ccadmin
[I 2024-07-09 20:46:05.893 JupyterHub spawner:1738] Spawning /usr/local/bin/jupyter-lab
[I 2024-07-09 20:46:06.738 JupyterHub log:192] 302 GET /hub/spawn/ccadmin → /hub/spawn-pending/ccadmin (ccadmin@::ffff:172.16.25.18) 1035.23ms
[I 2024-07-09 20:46:06.763 JupyterHub pages:397] ccadmin is pending spawn
[I 2024-07-09 20:46:06.767 JupyterHub log:192] 200 GET /hub/spawn-pending/ccadmin (ccadmin@::ffff:172.16.25.18) 8.83ms
[W 2024-07-09 20:46:06.864 JupyterHub _xsrf_utils:195] Skipping XSRF check for insecure request GET /hub/api/users/ccadmin/server/progress
[I 2024-07-09 20:46:07.232 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-07-09 20:46:07.289 LabApp] JupyterLab extension loaded from /usr/local/lib/python3.8/site-packages/jupyterlab
[I 2024-07-09 20:46:07.289 LabApp] JupyterLab application directory is /usr/local/share/jupyter/lab
[I 2024-07-09 20:46:07.290 LabApp] Extension Manager is ‘pypi’.
[I 2024-07-09 20:46:07.301 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-07-09 20:46:07.301 ServerApp] Serving notebooks from local directory: /home/ccadmin
[I 2024-07-09 20:46:07.301 ServerApp] Jupyter Server 2.14.1 is running at:
[I 2024-07-09 20:46:07.301 ServerApp] http://localhost:8888/lab?token=6fb4edcd5f38fc01cf8058b0b383ba6256560ee6166e010f
[I 2024-07-09 20:46:07.301 ServerApp] http://127.0.0.1:8888/lab?token=6fb4edcd5f38fc01cf8058b0b383ba6256560ee6166e010f
[I 2024-07-09 20:46:07.301 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 2024-07-09 20:46:07.311 ServerApp] No web browser found: Error(‘could not locate runnable browser’).
[C 2024-07-09 20:46:07.311 ServerApp]

To access the server, open this file in a browser:
    file:///home/ccadmin/.local/share/jupyter/runtime/jpserver-20116-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/lab?token=6fb4edcd5f38fc01cf8058b0b383ba6256560ee6166e010f
    http://127.0.0.1:8888/lab?token=6fb4edcd5f38fc01cf8058b0b383ba6256560ee6166e010f

[W 2024-07-09 20:46:15.737 JupyterHub base:1258] User ccadmin is slow to become responsive (timeout=10)
[W 2024-07-09 20:47:03.374 JupyterHub user:1050] ccadmin’s server never showed up at http://127.0.0.1:22493/user/ccadmin/ after 60 seconds. Giving up.

Common causes of this timeout, and debugging tips:

1. The server didn't finish starting,
   or it crashed due to a configuration issue.
   Check the single-user server's logs for hints at what needs fixing.
2. The server started, but is not accessible at the specified URL.
   This may be a configuration issue specific to your chosen Spawner.
   Check the single-user server logs and resource to make sure the URL
   is correct and accessible from the Hub.
3. (unlikely) Everything is working, but the server took too long to respond.
   To fix: increase `Spawner.http_timeout` configuration
   to a number of seconds that is enough for servers to become responsive.

[I 2024-07-09 20:47:03.375 ServerApp] interrupted
[I 2024-07-09 20:47:03.375 ServerApp] Serving notebooks from local directory: /home/ccadmin
0 active kernels
Jupyter Server 2.14.1 is running at:
http://localhost:8888/lab?token=6fb4edcd5f38fc01cf8058b0b383ba6256560ee6166e010f
http://127.0.0.1:8888/lab?token=6fb4edcd5f38fc01cf8058b0b383ba6256560ee6166e010f
Shut down this Jupyter server (y/[n])? [I 2024-07-09 20:47:03.376 ServerApp] resuming operation…
[C 2024-07-09 20:47:14.014 ServerApp] received signal 15, stopping
[I 2024-07-09 20:47:14.015 ServerApp] Shutting down 1 extension
[E 2024-07-09 20:47:14.542 JupyterHub gen:629] Exception in Future <Task finished name=‘Task-1594’ coro=<BaseHandler.spawn_single_user..finish_user_spawn() done, defined at /usr/local/lib/python3.8/site-packages/jupyterhub/handlers/base.py:1115> exception=TimeoutError(“Server at http://127.0.0.1:22493/user/ccadmin/api didn’t respond in 60 seconds”)> after timeout
Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/tornado/gen.py”, line 624, in error_callback
future.result()
File “/usr/local/lib/python3.8/site-packages/jupyterhub/handlers/base.py”, line 1122, in finish_user_spawn
await spawn_future
File “/usr/local/lib/python3.8/site-packages/jupyterhub/user.py”, line 1028, in spawn
await self._wait_up(spawner)
File “/usr/local/lib/python3.8/site-packages/jupyterhub/user.py”, line 1071, in _wait_up
raise e
File “/usr/local/lib/python3.8/site-packages/jupyterhub/user.py”, line 1042, in _wait_up
resp = await server.wait_up(
File “/usr/local/lib/python3.8/site-packages/jupyterhub/utils.py”, line 322, in wait_for_http_server
re = await exponential_backoff(
File “/usr/local/lib/python3.8/site-packages/jupyterhub/utils.py”, line 265, in exponential_backoff
raise asyncio.TimeoutError(fail_message)
asyncio.exceptions.TimeoutError: Server at http://127.0.0.1:22493/user/ccadmin/api didn’t respond in 60 seconds

[I 2024-07-09 20:47:14.543 JupyterHub log:192] 200 GET /hub/api/users/ccadmin/server/progress?_xsrf=[secret] (ccadmin@::ffff:172.16.25.18) 67682.28ms

Thanks manics.
due to consolidate the issue, I’m closing this thread and added a new post