17

I'm using jupyter 4.1.0, and I find myself making frequent use of the "Restart & Run All" feature. Every time I use that button it displays this warning:

enter image description here

Is there a way to disable that warning?

Thomas K
  • 39,200
  • 7
  • 84
  • 86
Mister Brainley
  • 632
  • 1
  • 7
  • 20
  • I feel that the accepted answer doesn't answer this question. The question mentions pressing the button which indicates it's a user interaction, not a script. The accepted answer addresses [this question](https://stackoverflow.com/questions/37751120/restart-ipython-kernel-with-a-command-from-a-cell). Is there a way to disable the prompt after manually selecting "Restart & Run All", for example? – Demitri Sep 13 '20 at 19:17

3 Answers3

29

You can add a cell in your notebook and using the following statements:

from IPython.core.display import HTML
HTML("<script>Jupyter.notebook.kernel.restart()</script>")

And the kernel will restart immediately.

kingbase
  • 1,268
  • 14
  • 23
1

To answer the question that was stated: No, there isn't.

But you might make your voice heard over here so they might implement it some day.

primfaktor
  • 2,831
  • 25
  • 34
0

You can create a bookmark in your browser for the following code:

javascript:Jupyter.notebook.execute_all_cells();void(0);

Clicking this bookmark runs all cells without asking for confirmation.

dinesh ygv
  • 1,840
  • 1
  • 14
  • 18
  • 1
    (I think that?) this will not restart the kernel, which is a problem if the reason you are restarting is that something very mysterious has happened in the global variable scope and you need to start from a clean slate. – MRule Aug 11 '21 at 16:24