Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

prevent jupyterlab from automatically starting new session for all open tabs

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)

like image 609
Amin Sabbaghian Avatar asked Dec 19 '25 23:12

Amin Sabbaghian


1 Answers

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

like image 155
uut Avatar answered Dec 21 '25 18:12

uut