We will be using Evcxr Jupyter Kernel for the Rust programming language.

Installation

  1. Make sure Rust and Jupyter is installed. Run rustc --version to verify Rust installation. Run jupyter --help to verify Jupyter installation.

  2. Build the kernel from source by running:

    cargo install --locked evcxr_jupyter

    This command will place the executable at ~/.cargo/bin/evcxr_jupyter.

  3. Run this command to verify if executable can reached through $PATH:

    which evcxr_jupyter

    If nothing could be found, make sure to add export PATH="$HOME/.cargo/bin:$PATH" in the shell file (e.g. ~/.zshrc).

  4. Run the following command in order to register the kernel with Jupyter:

    evcxr_jupyter --install

    By default, the above command will install the kernel into a user local directory, e.g., $HOME/.local/share/jupyter/kernels. But in my case (on macOS), it wrote the files in this path ~/Library/Jupyter/kernels/rust. (Path will be shown in the terminal as well when you run above command)

  5. We also need the source for the Rust standard library installed. We can confirm if it already installed or not using:

    rustup component list --installed | grep rust-sr

    Otherwise, install using the following command:

    rustup component add rust-src
  6. We can verify kernel registration using the following command:

    jupyter kernelspec list | grep rust

    It will show rust.

  7. Start Jupyter Notebook using:

    jupyter notebook

    Once started, it should open a page in your web browser. Look for the “New” menu on the right and from it, select “Rust”.

Uninstallation

evcxr_jupyter --uninstall
cargo uninstall evcxr_jupyter

You can check the latest README for more details.