Jupyter: Where does JupyterLab store user settings?

Viewed 1883

I've set up JupyterLab with a few keyboard shortcuts:

{// List of Keyboard Shortcuts
    "shortcuts": [
        {
            "command": "notebook:run-in-console",
            "keys": [
                "F9"
            ],
            "selector": ".jp-Notebook.jp-mod-editMode"
        },
        {
            "command": "notebook:clear-cell-output",
            "keys": [
                "F10"
            ],
            "selector": ".jp-Notebook.jp-mod-editMode"
        },
    ]
}

For a number of reasons, I've had to reinstall Anaconda and JupyterLab a few times, and I'm a bit surprised to see that JupyterLab always picks up the same shortcuts after each reinstallation. Isn't this supposed to be wiped out after a removal of Anaconda and JupyterLab? Or are some settings and / or folders left behind after a removal? And how do I access them and / or remove them for good? I've been using the standard Windows uninstall approach.

System info:

Windows 10
Ancaonda 2020.02
4 Answers

You can find where settings are by running

jupyter --path

So in my case, it shows:

config:
    /Users/machow/.jupyter
    /Users/machow/.virtualenvs/tidytuesday-py/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /Users/machow/Library/Jupyter
    /Users/machow/.virtualenvs/tidytuesday-py/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /Users/machow/Library/Jupyter/runtime

Where the one at top (/Users/machow/.jupyter) is the first place it will check. The second entry (/Users/machow/.virtualenvs/tidytuesday-py/etc/jupyter) is a virtual environment that I have active.

Since it goes down the list looking in each directory for what it needs, you may need to look around these to see which has settings in it. Usually, though it is the first entry. This is the case for me, so I have a folder named /Users/machow/.jupyter/lab/user-settings/ with the settings.

Note that the data section has things that a running notebook might keep track of, like each kernel session that is running!

For keyboard shortcuts, my jupyter lab is looking at this file: /Users/machow/.jupyter/lab/user-settings/\@jupyterlab/shortcuts-extension/shortcuts.jupyterlab-settings, where @jupyterlab is a "user". You can log out and in of jupyterlab as different users, and it will keep their settings in different folders.

On my computer it is in this folder:

%USERS%\MYUSERNAME\.jupyter\lab\user-settings\@jupyterlab

The folder is hidden by default, but can be unhidden in explorer. The config files in the subdirectories are plaintext.

I'm on MacOS so I can't check by myself as Jupiter is not installed on my virtual machine, but I would have a look in C:\Users\{username}\AppData\... and from there ...\Local\Jupyter\... or ...\Roaming\Jypyter\....

That's where user settings are usually stored.

Unless it is in C:\Users\{username}\Jupyter\..., which are not unusual but not the recommended way according to Microsoft Documentation as it is reserved to user documents.

It is possible it is in an hidden folder, so starting with a dot, as in \.jupyter\, but in this case you have to change a setting in Control Panel -> File and Folder in order to be able to see hidden files.

For some paths specific to Jupyter LAB, you can use this:

jupyter lab path

Here's an example of the output:

Application directory:   /Users/ryan/miniconda/envs/general/share/jupyter/lab
User Settings directory: /Users/ryan/.jupyter/lab/user-settings
Workspaces directory: /Users/ryan/.jupyter/lab/workspaces

The user-defined keyboard shortcuts are in User Settings directory under @jupyterlab/shortcuts-extension/shortcuts.jupyterlab-settings (as pointed out by @machow).

Related