My understanding of JUPYTER_CONFIG_PATH (or JUPYTER_CONFIG_DIR) is that this env variable will prepend a directory to the default jupyter path, and jupyterlab will search through these directories and use the configuration settings populated in any of these directories. (Upon conflict, precedence is determined by the order, as returned by jupyter --path and the first one wins).
However, this is not what I have observed. It seems to have something to do with a directory in jupyyter lab with mode being set to read-only. Light/Dark theme is used as an example. Other user Settings are similarly affected too. (I am running on jupyterlab 3.1.0a5, Mac and Linux, and use Mac output below).
Here are the details:
A. First I use default settings.
a. Confirm no env variable (no JUPYTER_NO_CONFIG, JUPYTER_CONFIG_PATH or JUPYTER_CONFIG_DIR).
b. Ran on a fresh conda env with only jupyterlab=3.0.14
c. Confirm that I can change the Settings of theme from Light to Dark.
d. Filed saved was I can see the file in ~/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings.
e. Upon restart of jupyterlab, it goes to Dark Theme correctly.
f. The output from juputer --path is: ~/.jupyter …
B. Then I set up JUPYTER_CONFIG_PATH:
$ mkdir ~/tmp/.jupyter
$ chmod -w ~/tmp/.jupyter
$ export JUPYTER_CONFIG_PATH=~/tmp/.jupyter
$ jupyter --path
No settings in ~/tmp/.jupyter whereas there is correct setting file in ~/.jupyter.
b. I then start $ jupyter lab
Jupyterlab goes to default Light theme, despite my settings in ~/.jupyter.
Question 1: is this a bug? Should JLab looks for additional settings beyond ~/tmp/.jupyter?
c. Then I try to update my
Settings ==> JupyterLab Theme ==> JupyterLab Dark
There is an error message indicating permission error:
PermissionError: [Errno 13] Permission denied: ‘/Users/xxxx/tmp/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings’
Questions 2: shouldn’t jlab try to find from each of the path, and write to the first writable one?
C. If I use JUPYTER_CONFIG_DIR (instead of JUPYTER_CONFIG_PATH):
jupyter --path will show ~/tmp/.jupyter (and system jupyter dir) but no ~/.jupyter
Upon jupyter lab starting up, it fails to come up:
PermissionError: [Errno 13] Permission denied: '/Users/xxxx/tmp/.jupyter/custom
Question 3: I was expecting JUPYTER_CONFIG_DIR should also include ~/.jupyter…
D. Same result in using jupyterlab==3.1.0a5 (issue b, c, d above)
E. Let me add the reason why we need to configure JUPYTER_CONFIG_PATH to be read-only?
In jupytelab 3.1.0a5, we can now configure to disable the download of files. So we would like to set up admin config (user read-only) to disable download as the first config that a user will see.