Skip to main content

ElasticKernel

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.

PyPI version Python versions Downloads Downloads/month License

🇯🇵 日本語版は README.ja.md を参照してください。

Demo

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
❌ 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.

Why 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.

Installation & Usage

Local

  1. Install the package:

    $ pip install elastic-kernel
    
  2. Install the kernel:

    $ elastic-kernel install
    Elastic Kernel installed from: /path/to/elastic_kernel
    
  3. Verify the kernel is installed:

    $ jupyter kernelspec list
    Available kernels:
      elastic_kernel    /path/to/Jupyter/kernels/elastic_kernel
    
  4. Launch JupyterLab:

    $ jupyter lab --ip=0.0.0.0
    
  5. Open JupyterLab in your browser.

  6. Select the Python 3 (ElasticKernel) kernel.

Docker

  1. Pull the image:

    docker pull ghcr.io/mryutaro/elastickernel
    
  2. Start a container:

    docker run -p 8888:8888 ghcr.io/mryutaro/elastickernel
    
  3. Open JupyterLab in your browser.

  4. Select the Python 3 (ElasticKernel) kernel.

Supported versions

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.

Supported libraries

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

How It Works

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.

Documentation

Publication

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}
}

Acknowledgments

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.

License

Licensed under the Apache License 2.0.

Metadata

Release files for elastic-kernel 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for elastic-kernel 0.2.3
File Size Uploaded
elastic_kernel-0.2.3.tar.gz 73.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for elastic-kernel 0.2.3
File Interpreter ABI Platform
elastic_kernel-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 140.5 kB

Release files / elastic_kernel-0.2.3.tar.gz

Download URL elastic_kernel-0.2.3.tar.gz
Size 73.4 kB
Tags Source
SHA-256 checksum
How to use checksums
19f4a46a3e3dd6ae93cb5a1e1616be1de3ccfb3f6f72bc3023cf2948754dfd10
BLAKE2b-256 checksum
How to use checksums
a457add56738cec3b652b215f34b751b892b4e43e4ed970eb1b34dae20affadf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / elastic_kernel-0.2.3-py3-none-any.whl

Download URL elastic_kernel-0.2.3-py3-none-any.whl
Size 67.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94ca81884f03203d350d595f4f8e024748966783c09c74c143aa87c91d8b38fc
BLAKE2b-256 checksum
How to use checksums
d44b162fc5faf0cdee49eb16ada3d5a7e7feef90d42a29f2d7b20b7053a17c82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.34

2 release files

0.0.33

2 release files

0.0.32

2 release files

0.0.31

2 release files

0.0.30

2 release files

0.0.29

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.23

2 release files

0.0.22

2 release files

0.0.21

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page