如何在Linux系统的Jupyter Notebook中安装Common-Lisp
Hey there! I’ve gone through this setup a few times, so let’s break down exactly how to get a Common Lisp notebook environment running in Jupyter on your Linux system. Here’s the step-by-step process:
Prerequisites
First, make sure you have these basics covered:
- A working Linux distribution (Debian/Ubuntu, Fedora, Arch, etc.)
- Python 3 and
pipinstalled (Jupyter is Python-based, so these are non-negotiable) - A Common Lisp implementation (we’ll use SBCL, the most widely adopted and reliable option)
Step 1: Install Jupyter Notebook
If you don’t already have Jupyter set up, install it using pip3—using a virtual environment is recommended to avoid messing with system-wide dependencies, but a system install works too:
pip3 install jupyter
Step 2: Install SBCL (Common Lisp Implementation)
SBCL is a fast, open-source Common Lisp compiler. Install it via your distro’s package manager:
- For Debian/Ubuntu-based systems:
sudo apt update && sudo apt install sbcl - For Fedora:
sudo dnf install sbcl - For Arch Linux:
sudo pacman -S sbcl
Step 3: Set Up Quicklisp (Lisp Package Manager)
Quicklisp is the go-to package manager for Common Lisp, and we’ll need it to install the Jupyter kernel. Here’s how to get it running:
- Download the Quicklisp installation script:
curl -O https://beta.quicklisp.org/quicklisp.lisp - Launch SBCL and run the installation:
Once inside the SBCL REPL (the interactive Lisp prompt), run these commands:sbcl --load quicklisp.lisp
This installs Quicklisp and configures it to load automatically every time you start SBCL.(quicklisp-quickstart:install) (ql:add-to-init-file)
Step 4: Install the Common Lisp Jupyter Kernel
We’ll use cl-jupyter, the official and most maintained Common Lisp kernel for Jupyter. Here’s how to install it:
- Launch SBCL again:
sbcl - Load
cl-jupytervia Quicklisp:(ql:quickload :cl-jupyter) - Install the kernel into Jupyter’s system:
The(cl-jupyter:install :user t):user tflag installs the kernel only for your account (no sudo needed). If you want a system-wide installation accessible to all users, omit this flag and run SBCL with sudo.
Step 5: Verify the Installation
Start Jupyter Notebook to confirm everything works:
jupyter notebook
In the Jupyter web interface, click the "New" button in the top-right corner—you should see "Common Lisp" listed as an option. Click it to open a new notebook, then test with a simple expression like:
(+ 1 2 3 4)
Run the cell, and you should get 10 as the output.
Troubleshooting Tips
- If you hit permission errors during kernel installation, double-check that you used
:user tor ran SBCL with sudo for system-wide installs. - If
cl-jupyterdoesn’t show up in Quicklisp, update your Quicklisp client first by running(ql:update-all)in the SBCL REPL. - If Jupyter doesn’t detect the kernel, restart Jupyter and verify the kernel files exist in
~/.local/share/jupyter/kernels/common-lisp/.
内容的提问来源于stack exchange,提问作者Matheus Popst de Campos

