# JupyterLab config issue in handling read-only config dir (user cannot save settings such as Dark Theme)

**URL:** <https://discourse.jupyter.org/t/jupyterlab-config-issue-in-handling-read-only-config-dir-user-cannot-save-settings-such-as-dark-theme/9302>\
**Category:** JupyterLab\
**Created:** [May 25, 2021, 12:31am UTC](https://discourse.jupyter.org/t/jupyterlab-config-issue-in-handling-read-only-config-dir-user-cannot-save-settings-such-as-dark-theme/9302 "2021-05-25T00:31:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hikemtshasta](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@hikemtshasta](https://discourse.jupyter.org/u/hikemtshasta)\
**Post date:** [May 25, 2021, 12:31am UTC](https://discourse.jupyter.org/t/jupyterlab-config-issue-in-handling-read-only-config-dir-user-cannot-save-settings-such-as-dark-theme/9302/1 "2021-05-25T00:31:37Z")

</div>

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:  
a.  
`
$ mkdir ~/tmp/.jupyter
$ chmod -w ~/tmp/.jupyter
$ export JUPYTER_CONFIG_PATH=~/tmp/.jupyter
$ jupyter --path
~/tmp/.jupyter
~/.jupyter
…
`  
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.

---

<div class="post-metadata">

**Author:** ![fcollonval](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fcollonval/32/801_2.png) [@fcollonval](https://discourse.jupyter.org/u/fcollonval)\
**Post date:** [May 26, 2021, 6:43am UTC](https://discourse.jupyter.org/t/jupyterlab-config-issue-in-handling-read-only-config-dir-user-cannot-save-settings-such-as-dark-theme/9302/2 "2021-05-26T06:43:32Z")

</div>

Hey @hikemtshasta

The environment variable roles can be displayed when running

```auto
jupyter --paths --debug

```

`JUPYTER_CONFIG_DIR` **overrides** the default path when `JUPYTER_CONFIG_PATH` is **preprended** to the config paths

Now about the settings, there are two kinds of configuration: at the server level and at the frontend level. Server settings are indeed to be found in any path of `jupyter --paths`. But the frontend settings like the theme are not. They must lie in one unique folder. It can be set using `JUPYTERLAB_SETTINGS_DIR` and default to use the first jupyter path.

Now about your need, the solution is to set the page\_config.json (it behaves like a server settings) file to disable some parts of JupyterLab: [Adding an option to disable file download on Jupyterlab · Issue #5274 · jupyterlab/jupyterlab · GitHub](https://github.com/jupyterlab/jupyterlab/issues/5274#issuecomment-825100032)

References:

- Env variables: [jupyter\_core/command.py at 46a9c512e9e461c848df4a2ea4d2b96c5e527804 · jupyter/jupyter\_core · GitHub](https://github.com/jupyter/jupyter_core/blob/46a9c512e9e461c848df4a2ea4d2b96c5e527804/jupyter_core/command.py#L234)
- JLab server config: [Advanced Usage — JupyterLab 3.0.16 documentation](https://jupyterlab.readthedocs.io/en/stable/user/directories.html#labconfig-directories)
- JLab frontend settings folder: [jupyterlab/commands.py at 16cba948f03a07578cb249c368ead7589b9cae6f · jupyterlab/jupyterlab · GitHub](https://github.com/jupyterlab/jupyterlab/blob/16cba948f03a07578cb249c368ead7589b9cae6f/jupyterlab/commands.py#L135)

---

<div class="post-metadata">

**Author:** ![hikemtshasta](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@hikemtshasta](https://discourse.jupyter.org/u/hikemtshasta)\
**Post date:** [May 27, 2021, 12:50am UTC](https://discourse.jupyter.org/t/jupyterlab-config-issue-in-handling-read-only-config-dir-user-cannot-save-settings-such-as-dark-theme/9302/3 "2021-05-27T00:50:02Z")

</div>

@ [fcollonval](https://discourse.jupyter.org/u/fcollonval):

Thanks very much! Your info is very much appreciated, as I didn’t know that JUPYTER\_CONFIG\_PATH only affects the server. I have tried the front-end config JUPYERLAB\_SETTINGS\_DIR as you mentioned and it works like a charm. So between these two env variables, I think I got what it takes to implement the solution.

Thanks again!
