A general info about Jupyter notebook



Recently I have started using Jupyter notebook and faced with an issue. Do I need to load dataset and run commands each time I start the kernal and shut it down?

As I am constantly getting a NameError that train dataset is not defined.


Each time you load a notebook you need to re-execute the initial program steps. Just go to each cell and hit SHIFT-ENTER again to get back to where you were


To save time one can also choose to run all cells in one go. Also, you can select multiple cells, contiguous or otherwise, to be run at a single time. But in general, yes, you’ll have to rerun the cells when you start the server anew – it doesn’t preserve state out-of-the-box, unfortunately.


@ASHISH_17, Every time you shut down the kernel all your variables saved in the memory are lost. Though if you want to run each cell quickly, you can do this -

  1. Click on Cell from menubar
  2. Select Run All
    This will execute all cells in order.


Hi @ASHISH_17, just a few more pointers, as most of the things, are already mentioned.

If you go to the website of jupyter notebook it clearly says:- “evolved to support interactive data science and scientific computing across all programming languages.”

It creates an API kind of engine when you launch the notebook, and once you kill the engine everything gets vanished, as most of the libraries are an in-memory process.

So when you write code on jupyter you can do it cell by cell and can interactively manipulate variables and code as you wish, once you kill the engine, you lose your variables which are stored in the RAM and your system memory gets free.

So everytime when you restart you need to run all the cells.