How to fix Jupyter Hub Exception: Jupyter command `jupyter-hub` not found.

Problem:

When trying to start jupyter hub, you see this error message:

[email protected]:~$ jupyter hub
Traceback (most recent call last):
  File "/usr/local/bin/jupyter", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/jupyter_core/command.py", line 285, in main
    command = _jupyter_abspath(subcommand)
  File "/usr/local/lib/python3.8/dist-packages/jupyter_core/command.py", line 124, in _jupyter_abspath
    raise Exception(
Exception: Jupyter command `jupyter-hub` not found.

Solution:

Remove the space between jupyter and hub. Instead of

jupyter hub

run

jupyterhub

Example:

[email protected] $ jupyterhub                           
[I 2021-06-19 02:37:12.766 JupyterHub app:2463] Running JupyterHub version 1.4.1
[I 2021-06-19 02:37:12.766 JupyterHub app:2493] Using Authenticator: jupyterhub.auth.PAMAuthenticator-1.4.1
[I 2021-06-19 02:37:12.766 JupyterHub app:2493] Using Spawner: jupyterhub.spawner.LocalProcessSpawner-1.4.1
[I 2021-06-19 02:37:12.766 JupyterHub app:2493] Using Proxy: jupyterhub.proxy.ConfigurableHTTPProxy-1.4.1
[I 2021-06-19 02:37:12.773 JupyterHub app:1534] Loading cookie_secret from /home/uli/dev/jupyterhub_cookie_secret
[I 2021-06-19 02:37:12.788 JupyterHub proxy:497] Generating new CONFIGPROXY_AUTH_TOKEN
[W 2021-06-19 02:37:12.789 JupyterHub app:1808] No admin users, admin interface will be unavailable.
[W 2021-06-19 02:37:12.789 JupyterHub app:1809] Add any administrative users to `c.Authenticator.admin_users` in config.
[I 2021-06-19 02:37:12.789 JupyterHub app:1838] Not using allowed_users. Any authenticated user will be allowed.
[I 2021-06-19 02:37:12.823 JupyterHub app:2530] Initialized 0 spawners in 0.001 seconds
[W 2021-06-19 02:37:12.825 JupyterHub proxy:699] Running JupyterHub without SSL.  I hope there is SSL termination happening somewhere else...
[I 2021-06-19 02:37:12.825 JupyterHub proxy:703] Starting proxy @ http://:8000
02:37:12.946 [ConfigProxy] info: Proxying http://*:8000 to (no default)
02:37:12.948 [ConfigProxy] info: Proxy API at http://127.0.0.1:8001/api/routes
02:37:12.981 [ConfigProxy] info: 200 GET /api/routes 
[I 2021-06-19 02:37:12.981 JupyterHub app:2778] Hub API listening on http://127.0.0.1:8081/hub/
02:37:12.982 [ConfigProxy] info: 200 GET /api/routes 
[I 2021-06-19 02:37:12.983 JupyterHub proxy:347] Checking routes
[I 2021-06-19 02:37:12.983 JupyterHub proxy:432] Adding route for Hub: / => http://127.0.0.1:8081
02:37:12.984 [ConfigProxy] info: Adding route / -> http://127.0.0.1:8081
02:37:12.985 [ConfigProxy] info: Route added / -> http://127.0.0.1:8081
02:37:12.986 [ConfigProxy] info: 201 POST /api/routes/ 
[I 2021-06-19 02:37:12.986 JupyterHub app:2853] JupyterHub is now running at http://:8000