I have saved a jupyter notebook checkpoint. If it is loaded, then the last printed output per cell is printed and the numbers in In[]
and Out[]
are visible. However, all variables are lost. Do jupyter notebook checkpoints do just that? By looking at the loaded checkpoints it gives the impression that everything has been remembered. Are the variables recoverable from them (without re-running the code)?
Asked
Active
Viewed 413 times
0

zach
- 95
- 1
- 7
-
If you shutdown the kernel, you lose what is set in the namespace. That namespace when the notebook is running is where the internal object are stored. So when you re-open the notebook, the namespace is blank until you run the code again. There are ways to store things that are expensive to computer so that you can restore them without having to recalculate. By default though, your are back at the start. The checkpoint just represents a saved notebook file. It **doesn't restore the namespace** settings that existed at the time it was saved when you reload it. There are options you can ... – Wayne Oct 25 '22 at 15:10
-
**opt in to explicitly** to make it easier to get back to a point, particularly if things were expensive. Inherited from IPython is the `%store` magic, see [here](https://ipython.readthedocs.io/en/stable/config/extensions/storemagic.html) and [here](https://www.blopig.com/blog/2020/05/storing-variables-in-jupyter-notebooks-using-store-magic/) or [here](https://levelup.gitconnected.com/how-to-store-variables-in-jupyter-notebook-fea8aa60a9b). There's also ways to serialize many of Python data types with pickle and dill, see [here](https://stackoverflow.com/a/52709087/8508004). – Wayne Oct 25 '22 at 15:14