https://github.com/ickc/pixi-kernel-jl
A Jupyter kernel to use Julia within a pixi environment.
https://github.com/ickc/pixi-kernel-jl
Last synced: 5 months ago
JSON representation
A Jupyter kernel to use Julia within a pixi environment.
- Host: GitHub
- URL: https://github.com/ickc/pixi-kernel-jl
- Owner: ickc
- License: bsd-3-clause
- Created: 2025-08-28T09:42:16.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-09-29T12:47:21.000Z (9 months ago)
- Last Synced: 2025-09-29T13:29:52.900Z (9 months ago)
- Language: Julia
- Size: 16.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pixi-kernel-jl
A small helper and template for using Julia inside a Pixi environment with Jupyter.
This repository has two related goals:
1. Provide a Jupyter kernel that automatically uses the Julia from your Pixi environment.
2. Offer a template to bootstrap and pin a Julia version inside a Pixi configuration so your notebooks use the intended Julia runtime.
## Important: bootstrap Julia before other Julia tasks
This project changed how the Julia runtime is prepared inside the Pixi environment. You must run the `bootstrap-julia` task before running other Julia-related tasks (for example `precompile`, `install-kernel`, `resolve`, or `update`). The bootstrap step installs the pinned Julia runtime (via `juliaup`) into the Pixi-managed prefix so subsequent Julia invocations use the intended runtime and depot paths.
If you skip `pixi run bootstrap-julia` you will see cryptic error like this:
ERROR: `1.11.7` from environment variable JULIAUP_CHANNEL is not installed. Please run `juliaup add 1.11.7` to install channel or version.
Run the bootstrap step once after creating or restoring the Pixi environment (for example after a fresh checkout or when the environment cache is not restored).
## Motivation
Julia projects are reproducible at the package-environment level (for example, `julia --project=@.` will find the environment by searching up the directory tree). However, reproducing the exact Julia *runtime* version used to run that environment is still manual and error-prone. This project helps by providing a kernel and bootstrap pattern that ensures the Julia binary used by Jupyter comes from the pinned Pixi configuration.
## Features
- Installs a Jupyter kernel named `Julia (Pixi)` which launches Julia from the Pixi-managed runtime.
- Includes a Pixi template showing how to pin a Julia release/channel (via `JULIAUP_CHANNEL`) and bootstrap that runtime for reproducible notebooks.
## Requirements
- Pixi installed and available in your environment.
- Jupyter (or JupyterLab) installed and available.
## Quick install
1. Clone this repository:
git clone git@github.com:ickc/pixi-kernel-jl.git
2. Change into the repository:
cd pixi-kernel-jl
3. Run the install script through Pixi:
```sh
pixi run bootstrap-julia
pixi run install-kernel
```
Be patient — on a cold start the installation may take around 90 seconds.
By default, the install will create or overwrite a kernel named `pixi-kernel-jl` inside your Jupyter kernels directory. You can confirm the installed kernels with:
jupyter kernelspec list
## How it works (high level)
- The kernel spec installed by `pixi run install-kernel` points Jupyter to a launcher script that activates the Pixi environment and then runs the pinned Julia binary from that environment.
- The provided `pixi.toml` demonstrates setting `JULIAUP_CHANNEL` to pin a Julia release/channel. Bootstrap scripts in the template ensure that the pinned Julia is the one actually launched by the kernel.
## Notes and limitations
- The current approach is specific to Julia. The same technique does not directly work for Python kernels (see related projects for Python/R approaches).
- This repository provides a template and a convenience kernel install; adapt or fork it for project-specific needs.
## Troubleshooting
- If the kernel does not appear in Jupyter, run:
jupyter kernelspec list
to verify installation and the kernel directory path.
- If the kernel fails to start, ensure:
- Pixi is correctly installed and `pixi run` works on your machine.
- You have run `pixi run bootstrap-julia` after the environment was created or restored. Without bootstrapping the Julia runtime, later Julia tasks may fail.
If you need help debugging a failure, collect the output from launching the kernel (or running the launcher script directly) and open an issue or pull request with the details.
## See also
- [renan-r-santos/pixi-kernel](https://github.com/renan-r-santos/pixi-kernel) — Jupyter kernels using Pixi for reproducible notebooks (includes approaches for Python and R).