Sign inGet started
← Back to all guides

Rust kernel in Deepnote for blazingly fast notebooks

By Filip Žitný

Updated on March 6, 2024

Deepnote is a versatile data science platform that supports multiple programming languages through various kernels. While Python is the primary language, Deepnote also supports other languages with custom Docker images.

The advantage of Rust in Deepnote can come in handy when you want to accomplish faster data processing. If this is your goal, then this guide is for you.

For users looking to work with Rust, I've prepared a setup for a Rust kernel in Deepnote using a custom environment. We will provide detailed instructions on setting up and running a Rust kernel in Deepnote and tips for troubleshooting common issues.

Setting up the Rust kernel

FROM deepnote/python:3.10

RUN apt-get update -y
RUN curl <https://sh.rustup.rs> -sSf > install_rust.sh
RUN bash install_rust.sh -y

ENV PATH="/root/.cargo/bin:${PATH}"

RUN cargo install evcxr_jupyter
RUN rustup component add rust-src

RUN pip install jupyter-console
RUN evcxr_jupyter --install

RUN jupyter kernelspec list
RUN jupyter console --kernel rust

ENV DEFAULT_KERNEL_NAME "rust"

Example: Running Rust code

fn main() {
    println!("Hello, world!");
}
main()

//as well as:

// println!("Hello world");
// eprintln!("Hello error");
format!("Hello {}", "world")
pub fn fib(x: i32) -> i32 {
    if x <= 2 {1} else {fib(x - 2) + fib(x - 1)}
}
(1..13).map(fib).collect::<Vec<i32>>()
// result: [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]

In conclusion, Deepnote's flexibility extends beyond Python, allowing for the integration of programming languages like Rust. The setup process is straightforward and it opens up opportunities for further integrations. This demonstrates Deepnote's versatility as a data science platform and its potential to cater to a wider range of user preferences and project requirements.

If you encounter further issues, please get in touch with our support. Let’s get Rusty in Deepnote!

Filip Žitný

Data Scientist

Follow Filip on Twitter, LinkedIn and GitHub

That’s it, time to try Deepnote

Get started – it’s free
Book a demo

Footer

Solutions

  • Notebook
  • Data apps
  • Machine learning
  • Data teams

Product

Company

Comparisons

Resources

  • Privacy
  • Terms

© Deepnote