Never lose your Jupyter variables to a kernel restart again.
ElasticKernel is a custom IPython kernel that automatically checkpoints your notebook's execution state and restores it after a restart or crash β no manual pickle.dump required. Pick up exactly where you left off.
π―π΅ ζ₯ζ¬θͺηγ― README.ja.md γεη §γγ¦γγ γγγ
The same workflow in both clips: define a variable a = 1, then restart the kernel. The difference is what happens next.
Standard kernel (ipykernel) |
ElasticKernel |
|---|---|
ipykernel.mp4 |
elastickernel.mp4 |
β After the restart, a is gone β %whos reports "Interactive namespace is empty." |
β
After the restart, a is automatically restored β %whos still shows aΒ Β intΒ Β 1. |
If the videos don't play inline, click them to view: ipykernel Β· ElasticKernel.
Every Jupyter user has been there: a long computation finishes, then an accidental kernel
restart (or an out-of-memory crash) wipes every variable in your session. The usual
workaround is scattering pickle.dump / joblib.dump calls everywhere and remembering to
reload them by hand.
ElasticKernel removes that chore entirely:
- π Automatic state recovery β your variables survive kernel restarts and shutdowns, with zero changes to your code.
- π§ Dependency-aware β tracks how cells and variables depend on one another to restore a consistent state.
- β‘ Cost-optimized checkpoints β for each variable it decides whether to serialize it or recompute it on restore, based on serialization size vs. recomputation cost (a min-cut optimization).
- πͺ Drop-in β just pick the
Python 3 (ElasticKernel)kernel; the rest of your workflow is unchanged.
-
Install the package:
$ pip install elastic-kernel
-
Install the kernel:
$ elastic-kernel install Elastic Kernel installed from: /path/to/elastic_kernel
-
Verify the kernel is installed:
$ jupyter kernelspec list Available kernels: elastic_kernel /path/to/Jupyter/kernels/elastic_kernel
-
Launch JupyterLab:
$ jupyter lab --ip=0.0.0.0
-
Open JupyterLab in your browser.
-
Select the Python 3 (ElasticKernel) kernel.
-
Pull the image:
docker pull ghcr.io/mryutaro/elastickernel
-
Start a container:
docker run -p 8888:8888 ghcr.io/mryutaro/elastickernel
-
Open JupyterLab in your browser.
-
Select the Python 3 (ElasticKernel) kernel.
ElasticKernel is tested on every push and pull request against a CI matrix of Python
versions. The checkpoint save β restore round trip (record_event β checkpoint β load_checkpoint) is verified on each of them.
| Component | Verified versions |
|---|---|
| Python | 3.9, 3.10, 3.11, 3.12, 3.13 |
| ipykernel / jupyterlab | latest release compatible with each Python above (resolved by uv sync) |
Python 3.8 reached end-of-life in October 2024 and is no longer tested. The version matrix lives in
.github/workflows/test.yml.
ElasticKernel can restore a checkpointed object two ways, and a cost optimizer (min-cut) picks one per object at checkpoint time β neither is merely a fallback:
- Migrate β serialize the object with dill and reload it.
- Recompute β re-run the cell that produced it.
CI verifies several representative object types per library below β a library exposes many types, so this is a sample rather than a whole-library guarantee β and reports whether each restore path reproduces each one.
Legend:
- β β restored correctly via this path.
- β β not serializable, so the Migrate path does not apply (ElasticKernel uses Recompute instead).
- β β failed: the object could not be restored, or it is a known limitation.
The table is generated by scripts/library_coverage.py and
kept in sync by the library-coverage workflow.
| Library | Object | Migrate | Recompute | Verified version |
|---|---|---|---|---|
| numpy | ndarray |
β | β | 2.3.4 |
structured array |
β | β | 2.3.4 | |
masked array |
β | β | 2.3.4 | |
datetime64 array |
β | β | 2.3.4 | |
| pandas | DataFrame |
β | β | 3.0.3 |
Series |
β | β | 3.0.3 | |
Series (category) |
β | β | 3.0.3 | |
DataFrame (DatetimeIndex) |
β | β | 3.0.3 | |
| scipy | csr_matrix (sparse) |
β | β | 1.17.1 |
csc_matrix (sparse) |
β | β | 1.17.1 | |
stats frozen distribution |
β | β | 1.17.1 | |
| scikit-learn | LinearRegression (fitted) |
β | β | 1.9.0 |
StandardScaler (fitted) |
β | β | 1.9.0 | |
RandomForestClassifier (fitted) |
β | β | 1.9.0 | |
| matplotlib | Figure (line plot) |
β | β | 3.11.0 |
Figure (imshow) |
β | β | 3.11.0 | |
| seaborn | FacetGrid |
β | β | 0.13.2 |
Axes (scatterplot) |
β | β | 0.13.2 | |
| opencv (cv2) | ndarray (grayscale image) |
β | β | 4.13.0.92 |
ndarray (color image) |
β | β | 4.13.0.92 | |
| requests | Response |
β | β | 2.32.5 |
Session |
β | β | 2.32.5 |
ElasticKernel extends the IPython kernel to observe each cell execution. As you run cells it builds a dependency graph of variables and the cell executions that produce them. When the kernel shuts down or restarts, it profiles serialization speed, runs a cost optimizer to split variables into a migrate set (serialized to disk) and a recompute set (regenerated by re-running cells), and writes a checkpoint. On the next start it loads the checkpoint, injects the migrated variables back into your namespace, and recomputes the rest.
- Developer guide: docs/DEVELOPERS.md
- ζ₯ζ¬θͺ README: README.ja.md
This project was presented in the following paper. If you use ElasticKernel in your research, please cite:
R. Matsumoto, K. Taniguchi, T. Hayami, K. Takahashi, and S. Date. "ElasticHub: A Cost-Efficient JupyterHub Platform via Automated Scaling with Kubernetes on Hybrid Cloud." Proceedings of the 16th International Conference on Cloud Computing and Services Science, pp. 261β268, 2026. DOI: 10.5220/0014840200004039
@inproceedings{matsumoto2026elastichub,
author = {Matsumoto, R. and Taniguchi, K. and Hayami, T. and Takahashi, K. and Date, S.},
title = {ElasticHub: A Cost-Efficient JupyterHub Platform via Automated Scaling with Kubernetes on Hybrid Cloud},
booktitle = {Proceedings of the 16th International Conference on Cloud Computing and Services Science},
year = {2026},
pages = {261--268},
isbn = {978-989-758-829-7},
issn = {2184-5042},
doi = {10.5220/0014840200004039}
}This project includes code from ElasticNotebook, developed at the University of Illinois. ElasticNotebook is licensed under the Apache License 2.0.
Zhaoheng Li, Pranav Gor, Rahul Prabhu, Hui Yu, Yuzhou Mao, Yongjoo Park. "ElasticNotebook: Enabling Live Migration for Computational Notebooks." Proceedings of the VLDB Endowment, Vol. 17, No. 2, pp. 119-133, 2023.
Licensed under the Apache License 2.0.