Skip to content

Kernels

jOtter doesn’t run code itself. Like JupyterLab, it starts a Jupyter kernel, a separate process that executes cells and sends back their output. Any kernel that speaks the Jupyter protocol works: Python’s ipykernel, IJulia, IRkernel, and others.

When a notebook opens, jOtter decides on a kernel name and then looks for a kernelspec with that name.

The name is, in order: the --kernel option, then the notebook’s own kernelspec (metadata.kernelspec.name, written by whatever tool saved it last), then python3.

For that name, jOtter searches these places and uses the first match:

  1. The activated environment: $VIRTUAL_ENV (venv, uv, poetry, pdm) or $CONDA_PREFIX (conda, mamba, pixi).
  2. A project virtualenv, even if it isn’t activated: jOtter starts in the notebook’s directory and walks up the directory tree, checking each level for a .venv or venv directory. The nearest one wins, so a .venv next to the notebook takes precedence over one at the project root.
  3. The global Jupyter paths: $JUPYTER_PATH, the standard system and user directories, and whatever jupyter --paths reports if Jupyter is installed.

If the name isn’t found anywhere, jOtter doesn’t guess. Like JupyterLab, it asks: a popup lists the installed kernels for the notebook’s language, or every installed kernel if there is none for it.

A popup titled “kernel 'julia-1.11' not found — start which?” with a filter field and the installed Julia kernels julia-1.12 and julia-1.10

Type to narrow the list, move with ↑/↓, and press Enter to start the selected kernel. It replaces the notebook’s kernelspec with the next save, so you are asked only once. Esc leaves the notebook without a kernel; R asks again.

Kernels from an environment (steps 1 and 2) run with that environment’s own Python, so import sees exactly the packages installed there. The kernel’s working directory is the notebook’s directory, so relative paths in your code behave as they do in JupyterLab.

Section titled “Recommended setup: one virtualenv per project”

Keep a single .venv with ipykernel at the project root, next to pyproject.toml, and put notebooks wherever they belong in the tree:

my-project/
├── .venv/ # ipykernel + your dependencies
├── pyproject.toml
├── src/
└── notebooks/
└── analysis.ipynb # finds ../.venv on its own

Every notebook in the project then runs against the same packages as the rest of your code. Nothing needs activating, and it doesn’t matter which directory you start jOtter from: the search begins at the notebook, not at your shell’s working directory.

This is the layout uv and pdm create by default. Reach for the alternatives only when you need them:

  • A notebook that needs different packages gets its own .venv in its directory, which shadows the project one.
  • To use an environment that lives outside the project tree (conda, a shared venv), activate it before starting jOtter. An activated environment always beats a .venv found by walking up.
  • A kernel shared across projects is best registered as a named kernel.

Install ipykernel into the environment your notebook should use. Run these from the project root:

Terminal window
uv init # skip if the project has a pyproject.toml
uv add numpy matplotlib # what your code imports
uv add --dev ipykernel # creates .venv on first use
jotter notebook.ipynb # finds .venv on its own

--dev marks ipykernel as a tool for working on the project rather than something its code imports, so it stays out of the dependencies of a package you publish. It is installed into .venv either way.

Named kernels registered with Jupyter are found through the global paths. Register one from any environment and pick it with --kernel:

Terminal window
python -m ipykernel install --user --name phys --display-name "Python (phys)"
jotter --kernel phys notebook.ipynb

jupyter kernelspec list shows every kernel Jupyter knows about. If the notebook has no kernelspec yet (a new notebook, or one generated by a script), jOtter records the kernel it started, and the next save writes it into the metadata, so next time --kernel isn’t needed. An existing kernelspec is only replaced when its kernel is missing and you pick another one; --kernel applies to the current session only.

Install the language’s Jupyter kernel and register it, then open the notebook as usual. Syntax highlighting and the file type used by the external editor follow the notebook’s language (metadata.language_info, or the kernelspec’s language), not just Python.

Each command below runs in your shell, installs the kernel and registers its kernelspec for your user. jupyter kernelspec list (or jOtter’s kernel popup) shows the result.

IJulia, registered as julia-<version>, e.g. julia-1.12:

Terminal window
julia -e 'using Pkg; Pkg.add("IJulia"); using IJulia; installkernel("Julia")'

The repository has a small notebook to try each with: examples/julia.ipynb, examples/r.ipynb and examples/rust.ipynb.

The kernel starts in the background as soon as the notebook opens; the status line shows starting kernel '…'. You can run cells right away: they wait in a queue until the kernel is ready.

Press R to restart the kernel. jOtter asks first: R again restarts, a restarts and then runs all cells. If a kernel can’t be found or dies, the status line says why and R starts a new one. Troubleshooting covers the usual causes.