16

I shut down all kernels and close jupyterlab in the browser, but when I open it again it starts a session, and a kernel, for all opened notebooks

I'd followed the code and found that in jupyterlab notebook code the start session function calls (POST /api/sessions) on notebook load if there is not any running kernel for the current notebook. and the API creates a session and also starts a kernel.

I can't find any config for stopping this action in jupyter configs or jupyterlab settings (settings -> advanced settings editor)

Amin Sabbaghian
  • 391
  • 1
  • 8
  • 4
    I absolutely agree that the default jupyterlab behavior of automatically starting kernels when opening a notebook is not useful. Often I open a notebook to compare the results or to look at the code. Did you consider filing an option to "not start kernel" ? – yus Nov 17 '21 at 23:24

1 Answers1

4

You can prevent automatically starting kernels when you open a notebook by running Jupyterlab with the jupyter lab --LabServerApp.notebook_starts_kernel=False flag.

To make the configuration permanent, you can add c.LabServerApp.notebook_starts_kernel = False to $(jupyter --config-dir)/jupyter_lab_config.py. If this file doesn't exist yet, generate it by running jupyter lab --generate-config.

See this issue comment for more details:
https://github.com/jupyterlab/jupyterlab/issues/12019#issuecomment-1145841583

uut
  • 1,834
  • 14
  • 17