Settings not picked up by JupyterLab

I am setting up Jupyterhub to front jupyterlab for the first time and I am having trouble propagating config to jupyterlab, specifically c.LabAll.app_dir

I brought in and added some debugging information into traitlets so I can see what config files it is loading and the results

contents of /tmp/jupyterhub_config.py

c.JupyterHub.authenticator_class = 'dummy'
c.Spawner.default_url = '/lab'

contents of /local/home/cladam/.jupyter/jupyter_notebook_config.py

c.LabApp.app_dir = '/my/env/share/jupyter/lab'
$ jupyterhub --config=/tmp/jupyterhub_config.py
... successful startup omitted ...

[I 2020-04-27 03:48:17.774 JupyterHub app:2631] JupyterHub is now running at http://:8000
[I 2020-04-27 03:48:26.657 JupyterHub log:174] 302 GET / -> /hub/ (@::ffff:10.143.206.142) 1.67ms
[I 2020-04-27 03:48:26.839 JupyterHub log:174] 302 GET /hub/ -> /hub/spawn (adam@::ffff:10.143.206.142) 10.70ms
[I 2020-04-27 03:48:27.201 JupyterHub spawner:1417] Spawning jupyterhub-singleuser --port=41975 --NotebookApp.default_url=/lab
[I 2020-04-27 03:48:30.680 JupyterHub log:174] 302 GET /hub/spawn -> /hub/spawn-pending/adam (adam@::ffff:10.143.206.142) 3507.27ms
[I 2020-04-27 03:48:30.705 JupyterHub log:174] 200 GET /hub/error/503?url=%2Fhub%2Fspawn (@127.0.0.1) 40.76ms
[I 2020-04-27 03:48:30.705 JupyterHub pages:174] Server adam is already active
[I 2020-04-27 03:48:30.706 JupyterHub log:174] 302 GET /hub/spawn -> /hub/spawn-pending/adam (adam@::ffff:10.143.206.142) 40.33ms
[I 2020-04-27 03:48:31.038 JupyterHub pages:347] adam is pending spawn
[I 2020-04-27 03:48:31.041 JupyterHub log:174] 200 GET /hub/spawn-pending/adam (adam@::ffff:10.143.206.142) 5.53ms

>>> BEGIN MY DEBUG OUTPUT
found config witb <class 'traitlets.config.loader.PyFileConfigLoader'> at /local/home/adam/.jupyter/jupyter_notebook_config.py
{'LabApp': {'app_dir': '/my/env/share/jupyter/lab'}}
found config witb <class 'traitlets.config.loader.JSONFileConfigLoader'> at /local/home/adam/.jupyter/jupyter_notebook_config.json
{'NotebookApp': {'nbserver_extensions': {'jupyterlab': True}}}
>>> END MY DEBUG OUTPUT

[I 2020-04-27 03:48:32.464 SingleUserNotebookApp extension:158] JupyterLab extension loaded from /my/env/lib/python3.6/site-packages/jupyterlab
[I 2020-04-27 03:48:32.464 SingleUserNotebookApp extension:159] JupyterLab application directory is /my/env/python3.6/share/jupyter/lab
[E 2020-04-27 03:48:32.464 SingleUserNotebookApp extension:181] JupyterLab application assets not found in "/my/env/python3.6/share/jupyter/lab"
[E 2020-04-27 03:48:32.464 SingleUserNotebookApp extension:181] Please run `jupyter lab build` or use a different app directory

LabApp doesn’t seem to be picking up my settings, even though it looks like it is reading the config file.

How is this supposed to work? what is the correct way to configure various parts of jupyter*?

I’m having a similar issue. Since Python on the main CentOS 7 repositories is stuck on 3.6, I’ve installed 3.8 via SCL.

I have JupyterHub up and running after changing some of the existing configurations I already had, but I cannot get JupyterLab to spawn. Navigating to /lab provides a 404 error. JupyterHub works fine.

jupyterhub: [I 2020-08-19 12:58:30.013 SingleUserNotebookApp log:174] 302 GET /user/vagrant/ -> /user/vagrant/lab?
jupyterhub: [W 2020-08-19 12:58:30.136 SingleUserNotebookApp log:174] 404 GET /user/vagrant/lab? 

I’ve tried setting c.LabApp.app_dir to where the JupyterLab application directory is, but I’m not getting anywhere either.

The only other documented case of redirecting the application directory I’ve seen is overriding the JUPYTERLAB_DIR environment variable to point to the directory, I’ve tried this also with no luck, but I have only seen it used specific to solo JupyterLab instances, not running alongside JupyterHub.

Is anyone able to advise?

Edit: Resolved my issue.

In my case I had to enable the jupyterlab extension, something I didn’t need to do on non-SCL builds.

jupyter serverextension enable --py jupyterlab --system

I enabled this system-wide as multiple users will be utilising the system, but if only required on a user-tp-user basis, you can use --user.

This is my very first post to the Jupyter Discourse Forum, so apologies if I am doing something wrong.

I did a brand new install of (mini)conda yesterday. I installed Jupyter Lab (among other programs), ran ‘jupyter lab --generate-config’ and ‘jupyter serverextension enable --py jupyterlab --user’, but Jupyter Lab crashes with the error message ‘Bad config encountered during initialization: Trait, server_extensions, not found.’. I am running conda on stock Linux Mint, fully updated. I decided to resurrect this old thread (which I found by googling) because it seems to me that the new configuration required of Jupyter Lab somehow is not picking the libraries it needs.

Have you checked the output of pip list to see if there is a python module dependency that you might be missing? If you have an older version of pip on the system, the dependency resolver may not be functioning as you’d expect (they had a change in resolver in October 2020 with version 20.3, and as a that older one just tells you basically oops I can’t resolve this thing good luck instead of the typical pip magic that you’d expect). So if you’re using newer modules that rely on that new resolver you may run into problems.

Hello,

I have just run pip list. I just see an output with module versions. The pip version shown is 21.2.4. I am running in a conda environment. Most of my modules have been installed via conda install -c conda-forge (because somewhere I read that insisting on conda forge may resolve a lot of dependency issues, especially when super-complex software such as pymc is involved), but some of my modules had to be installed via pip because I couldn’t find them in the conda channels. Does pip list pick up dependencies of software installed via conda install?

I’m afraid I’m completely ignorant of how things are sorted with conda. Perhaps someone else might be able to chime in. But just at a glance that error looks like something I would expect if there was a dependency that wasn’t met.

I’m afraid that your issues may stem from having multiple conflicting versions of jupyterlab installed in different conda and non-conda environments. One approach would be to uninstall all jupyterlab and jupyter-server copies, remove configs and then install anew in a fresh environment, making sure not to mix conda and pip.

1 Like

Since I have a similar issue and this was one of the first hits in google for my problem, I want to document my solution (maybe it helps the next one, that finds this discussion).

I had the following error:

$ python -m jupyter lab --no-browser                                                                                                                                   
[I 2023-12-12 12:34:45.417 ServerApp] jupyterlab | extension was successfully linked.                                                                                                                        
[C 2023-12-12 12:34:45.436 NotebookApp] Bad config encountered during initialization: Trait, server_extensions, not found.      

When I deleted my ~/.jupyter/jupyter_notebook_config.json it was working again.
I guess the key server_extensions caused this problem:

~/.jupyter$ cat jupyter_notebook_config.json
{
  "NotebookApp": {
    "nbserver_extensions": {
      "jupyterlab": true
    },
    "server_extensions": [
      "jupyter_nbextensions_configurator"
    ]
  }
}
1 Like