After creating a custom Matlab kernel, you'll see the option for a `MATLAB Kernel` on the Launcher screen. 

Instructions

Please run the following script, after updating the top section to specify the `ROOT` directory in which you want to create your virtual environment, and the name of your virtual environment. You may also wish to experiment with different versions of Python and Matlab.

#!/usr/bin/env bash
set -euo pipefail
#####################################################
# User-customizable settings
ROOT="/usr/workspace/$USER/matlab-jupyter-testing"
KERNEL_NAME="matlabenv_v4"
MATLAB_ROOT="/collab/usr/gapps/estk/matlab-2025b"
LICENSE_MODE="existing"
LICENSE_FILE="/collab/usr/gapps/estk/matlab-2025b/licenses/network.lic"
#####################################################
module load python/3.12.2
VENV="$ROOT/${KERNEL_NAME}"
KERNEL_DIR="$HOME/.local/share/jupyter/kernels/$KERNEL_NAME"
WRAPPER_DIR="$ROOT/.kernel_bin"
mkdir -p "$ROOT" "$KERNEL_DIR" "$WRAPPER_DIR"
cd "$ROOT"
python3 -m venv "$VENV"
source "$VENV/bin/activate"
python -m pip install --upgrade pip
python -m pip install jupyterlab jupyter-matlab-proxy
cat > "$WRAPPER_DIR/matlab-proxy-app" <<EOF
#!/usr/bin/env bash
set -euo pipefail
exec "$VENV/bin/python" -m matlab_proxy.app "\$@"
EOF
chmod 755 "$WRAPPER_DIR/matlab-proxy-app"
if [[ "$LICENSE_MODE" == "network" ]]; then
 LICENSE_JSON="    \"MLM_LICENSE_FILE\": \"$LICENSE_FILE\""
elif [[ "$LICENSE_MODE" == "existing" ]]; then
 LICENSE_JSON='    "MWI_USE_EXISTING_LICENSE": "true"'
else
 echo "Unsupported LICENSE_MODE: $LICENSE_MODE" >&2
 echo "Use LICENSE_MODE=existing or LICENSE_MODE=network" >&2
 exit 1
fi
cat > "$KERNEL_DIR/kernel.json" <<EOF
{
 "argv": [
   "$VENV/bin/python",
   "-m",
   "jupyter_matlab_kernel",
   "-f",
   "{connection_file}"
 ],
 "display_name": "MATLAB Kernel",
 "language": "matlab",
 "interrupt_mode": "message",
 "env": {
   "PATH": "$WRAPPER_DIR:$VENV/bin:/usr/bin:/bin",
   "MWI_CUSTOM_MATLAB_ROOT": "$MATLAB_ROOT",
$LICENSE_JSON
 },
 "metadata": {
   "debugger": false
 }
}
EOF
cat <<EOF
MATLAB kernel setup complete.
Virtual environment:
 $VENV
Kernelspec:
 $KERNEL_DIR/kernel.json
License mode:
 $LICENSE_MODE
EOF

Expected output

After running this script, you should see output ending with something like

MATLAB kernel setup complete.
Virtual environment:
 <Path to your venv will print here>
Kernelspec:
 <your $HOME>/.local/share/jupyter/kernels/<Kernel name>/kernel.json
License mode:
 existing

 

Testing

After starting up Orbit, look for the "MATLAB Kernel" on the Launcher tab. Open a notebook with this kernel and make sure you get valid output after running a cell with

ver
A = [1 2 3; 4 5 6]
size(A)
whos A