An evaluation context for Rust.




An evaluation context for Rust.

This project consists of several related crates.

  • evcxr_jupyter - A Jupyter Kernel

  • evcxr_repl - A Rust REPL

  • evcxr - Common library shared by the above crates, may be useful for other purposes.

  • evcxr_runtime - Functions and traits for interacting with Evcxr from libraries that users may use from Evcxr.

If you think you'd like a REPL, I'd definitely recommend checking out the Jupyter kernel. It's pretty much a REPL experience, but in a web browser.

To see what it can do, it's probably best to start with a tour of the Jupyter kernel. Github should allow you to preview this, or you can load it from Jupyter Notebook and run it yourself.


This is not an officially supported Google product. It's released by Google only because the (original) author happens to work there.

  • Windows build error

    Windows build error

      = note: libzmq-50f4a406b22aace0.rlib(zmq-50f4a406b22aace0.zmq.adwk1sko-cg
    u.4.rcgu.o) : error LNK2019: unresolved external symbol __imp_zmq_msg_gets
    referenced in function _ZN3zmq7message7Message4gets17h7fa806d7747a2351E
    u.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_zmq_proxy_ste
    erable referenced in function _ZN3zmq15proxy_steerable17h28199adb82db8604E
    u.0.rcgu.o) : error LNK2019: unresolved external symbol __imp_zmq_has refer
    enced in function _ZN3zmq3has17h8a1799c5696eeb89E
    da4bb74.exe : fatal error LNK1120: 3 unresolved externals

    I'm on Windows 10, first tried to cargo install evcxr-jupyter, got an error described here, then cloned the master branch and trying to build it. I've installed ZeroMQ 4.0.4 via installer, renamed lib and dll files as recommended and added .dll dir to PATH.

    opened by axil 38
  • Mac OS support

    Mac OS support

    In the unlikely event that it already works on Mac OS, please let me know.

    If you'd like to work on this, feel free to reach out with any questions. I'm not really sure what will be involved, since I don't know what the problems will be.

    opened by davidlattimore 15
  • [WIP] Add helpers into evcxr_runtime

    [WIP] Add helpers into evcxr_runtime


    This PR is a try to extend runtime with helpers and shortcuts but I need your feedback about:

    1. Do you want to have some helpers / ready to function like gophernotes/Display.ipynb at master · gopherdata/gophernotes as part of the lib. Is evcxr_runtime the right place to add helpers / shortcut to display content from outside (serde_json, images, vega, ndarrays,...) ? or do you prefer
      1. to have them into each own sub-project (enabling rust features is not accessible from jupyter kernel)
      2. to have them into an other project / repository (not under evcxr repository)
      3. other suggestions ?
    2. If ok for helpers, to you have some guidelines you would like we follow ?
    3. how to play in jupyter/repl with an unpublished crates (wip,...) ?

    Tell me before I push other helpers function.

    If you like I can move the cherry-pick the first commit into an other PR.

    opened by davidB 14
  • Add config files to make it possible to run in Binder

    Add config files to make it possible to run in Binder


    I added a button to start a dynamic version of this repo on Binder and the required config files (apt.txt and postBuild). I'm still trying to figure out why it doesn't work on the notebook, but if you open a terminal and run jupyter console --kernel rust it works fine.

    This one points to the PR branch: Binder where you can test and reproduce the problem.

    Pinging @yuvipanda @betatim @choldgraf: is there any way to check the Binder logs (as an user) to see why the kernel initialization fails? (it works fine locally or on the terminal in Binder).

    opened by luizirber 13
  • Use ariadne for rendering diagnostics

    Use ariadne for rendering diagnostics


    In REPL: image

    in jupyter notebook: image


    in REPL: image

    I didn't managed to make it working in jupyter notebook.

    This PR is just a proof of concept, for giving feedback. It doesn't actually work for anything other than my example (I added a +20 offset for spans somewhere to make it working) and it should show helps and notes using ariadne as well (the currently rendered help is from old code). Ariadne has a very easy to use api, it gets a list of files with their sources (commands and cells in our use case) and a list of spans (declared with byte ranges) with messages and colors, then it will automatically render everything in the right place. So someone that know more than me (= more than nothing) about evcxr can do it the right way fairly easily. But I can also make it with some mentoring if needed.

    Rust is famous for its great compile messages. Lets make them great in evcxr as well!

    opened by HKalbasi 11
  • Feature Request: Rust 1.51

    Feature Request: Rust 1.51 "const generics" (if and when they become possible)

    Rust 1.51.0 is now out, and it includes a new feature called "Const Generics" (well, not entirely new - but see the rust blog for all the details). This feature does not appear to work with evcxr-jupiter.

    Here's a minimal test case -- I've made a Jupyter cell with this code (taken, slightly changed, from the blog entry linked above):

    pub struct TestArray<T, const LENGTH: usize> {
        //                 ^^^^^^^^^^^^^^^^^^^ Const generic definition.
        pub list: [T; LENGTH]
        //        ^^^^^^ We use it here.
    let test_array = TestArray::<u8,42>{ list: [0u8; 42] };
    assert_eq!( test_array.list.len(), 42 );

    I get the following output:

    pub struct TestArray<T, const LENGTH: usize> { ^ pub struct TestArray<T, const LENGTH: usize> { ^^^^^^ pub struct TestArray<T, const LENGTH: usize> { ^^^^^^^^^ struct defined here, with 2 generic parameters: T, LENGTH

    However, when I put that code in the crate I'm working on (as a test case), it compiles and runs just fine!

    I tried reinstalling evcxr-jupyter to see if that would help it use the latest rust version, with no luck. I suppose I may have broken something in the process, so I'm very curious if it's just my environment. Does that code work for anyone else?

    I haven't tried cloning the repository to make sure I have the bleeding edge version. Would it be helpful if I did, or should I just be patient for a new version to come out (and use "cargo install")?

    Thanks in advance!

    opened by ProfRon 11
  • evcxr_repl install fails

    evcxr_repl install fails

    When I run

    cargo install evcxr_repl

    on my Mac running High Sierra version 10.13.6, the build fails with

    error[E0046]: not all trait items implemented, missing: `description`
       --> /Users/alan/.cargo/registry/src/
    314 | impl std::error::Error for Error {}
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `description` in implementation
        = note: `description` from trait: `fn(&Self) -> &str`
    error: aborting due to previous error
    For more information about this error, try `rustc --explain E0046`.
    error: failed to compile `evcxr_repl v0.1.2`, intermediate artifacts can be found at `/var/folders/9t/_qss6y9544v29s4y30lkz5jr0000gn/T/cargo-install5FRvBt`
    Caused by:
      Could not compile `evcxr`.
    To learn more, run the command again with --verbose.

    I am running

    cargo 1.26.0-nightly (008c36908 2018-04-13)

    One clue to the problem is that I am using the Failure crate, which has its own Error trait.

    opened by alanhkarp 11
  • Can't build evcxr_repl on FreeBSD (likely cause old libc)

    Can't build evcxr_repl on FreeBSD (likely cause old libc)

       Compiling sig v1.0.0
    error[E0425]: cannot find value `SIGSTKFLT` in crate `libc`
       --> /User/.cargo/registry/src/
    32  |     pub const STKFLT : c_int = libc::SIGSTKFLT; // Stack fault.
        |                                      ^^^^^^^^^ help: a constant with a similar name exists: `SIGSTKSZ`
       ::: /User/.cargo/registry/src/
    348 | pub const SIGSTKSZ: ::size_t = MINSIGSTKSZ + 32768;
        | --------------------------------------------------- similarly named constant `SIGSTKSZ` defined here
    error[E0425]: cannot find value `SIGPOLL` in crate `libc`
       --> /User/.cargo/registry/src/
    43  |     pub const POLL   : c_int = libc::SIGPOLL;   // Pollable event occured (System V).
        |                                      ^^^^^^^ help: a constant with a similar name exists: `SIGILL`
       ::: /User/.cargo/registry/src/
    438 | pub const SIGILL: ::c_int = 4;
        | ------------------------------ similarly named constant `SIGILL` defined here
    error[E0425]: cannot find value `SIGPWR` in crate `libc`
      --> /User/.cargo/registry/src/
    44 |     pub const PWR    : c_int = libc::SIGPWR;    // Power failure restart (System V).
       |                                      ^^^^^^ not found in `libc`
    error: aborting due to 3 previous errors

    System: FreeBSD 12.1, x86_64

    opened by dmilith 9
  • Add Cargo.lock

    Add Cargo.lock

    I'm interested in packaging this tool using Nix. There was a long thread here about how to do so for a crate that doesn't include Cargo.lock in version control, and the conclusion seems to be that the easiest thing is to just add it :)

    Since this project produces binaries, it seems to be recommended by the Cargo book to include it as well.

    opened by thomasjm 9
  • Update REPL documentation

    Update REPL documentation

    The evcxr_repl is amazing! However, the readme and documentation is pretty scarce. I updated the readme with codeblocks and more details for some of the useful options. Hopefully this will make the REPL more appealing to viewers.

    View rendered updates

    opened by ibraheemdev 8
  • Corrupted error messages in latest v0.5.0 on Windows

    Corrupted error messages in latest v0.5.0 on Windows

    Version: 0.5.0 CPU: Ryzen 1700 OS: Windows 10 Toolchain: x86_64-pc-windows-msvc

    How to recreate the error:

    1. Install evcxr: cargo install evcxr
    2. Wait for the REPL to load completely
    3. Write something that is not valid Rust, for example error
    4. Corrupted error messages will appear, with consistent behavior


    Welcome to evcxr. For help, type :help
    >> error
       ^^^^^ not found in this scope
    cannot find value `error` in this scope
    opened by MirkoCovizzi 8
  • Tokio no reactor running error

    Tokio no reactor running error

    I'm running the AWS Rust SDK in a notebook.

    I have the following cells: Cell 1:

    :dep aws-config = "0.47.0"
    :dep aws-sdk-sagemaker = "0.17.0"
    :dep aws-sdk-sagemakerruntime = "0.17.0"
    :dep tokio = { version = "1", features = ["full"]}
    :dep aws-smithy-types-convert = { version = "0.47.0", features = ["convert-chrono"] }

    Cell 2:

    let config = aws_config::load_from_env().await;

    If I try to use the config variable in subsequent cells, for example:

    let client = aws_sdk_sagemaker::Client::new(&config);
    let job_details = client.list_training_jobs().send().await?;

    I got the following error:

    thread '<unnamed>' panicked at 'there is no reactor running, must be called from the context of a Tokio 1.x runtime', /root/.cargo/registry/src/

    Not sure if this is related to how evcxr reuses the Tokio runtime? The Rust SDK also uses Tokio.

    I tried a workaround by repeating the following line in every cell that needs it:

    let config = aws_config::load_from_env().await;

    But then the code only works for the first execution, the 2nd call fails with some kind of timeout which I still need to debug further.

    opened by shinglyu 5
  • Reporting type errors on code running successfully in a cargo project

    Reporting type errors on code running successfully in a cargo project

    Dear all, thanks for checking this!

    I'm trying to create a jupyter notebook with evcxr and plotters. I'm writing some extension code to plotters to support gif animation in the jupyter notebook. However, evcxr is reporting a weird type mismatch issue which I couldn't figure out. I also put the code in a separate cargo code repository and it runs smoothly (printing out the evcxr_display message).

    Could someone please take a look at this issue and help me with it? Really appreciate it!

    The jupyter notebook is at There are three cells in it.

    • The first cell is about the dependencies and import the plotters evcxr_bitmap_figure function. If you are to create a new local cargo project, you will need to update your Cargo.toml based on this cell (the plotters-jupyter-gifs is also needed, which must be included using git).

    • The 2nd cell is about some function definitions, constants, structs. You can safely put its content outside your main function.

    • The 3rd cell is the code to run. You will need to put this part in your main function. Note to check the line starting with let figure. If using the line with evcxr_gif_figure, it will not produce error messages and show you a gif image. If you comment out that line and uncomment the line with evcxr_bigmap_figure, it will produce the error message about type mismatching.

    The error message I got from the jupyter notebook (I also tried evcxr_repl, same errors reported):

                            ^^^^^^^^^ expected struct `plotters::drawing::area::DrawingArea`, found struct `DrawingArea`   
                       ^^^^ arguments to this function are incorrect                                                       
    mismatched types                                                                                                       
                            ^^^^^^^^^ expected struct `plotters::drawing::area::DrawingArea`, found struct `DrawingArea`   
                       ^^^^ arguments to this function are incorrect                                                       
    mismatched types                                                                                                       
                            ^^^^^^^^^ expected struct `plotters::drawing::area::DrawingArea`, found struct `DrawingArea`   
                       ^^^^ arguments to this function are incorrect                                                       
    mismatched types

    After doing all the above, you could run cargo run to see the console printing out the evcxr_display message

    In order to let you reproduce the bug easier, I've made the evcxr_bug branch containing the you need. The file src/ is what you will need with minor changes. Or you can try it out directly with cargo run under the project.

    opened by lisanhu 4
  • Using already-compiled local crate's build directory instead of recompiling

    Using already-compiled local crate's build directory instead of recompiling

    Somewhat related to #96 -- I tried to implement a shell for rust-based webapps (see create-rust-app) but could not improve the initial compile times for local crates.

    Is it possible for EVCXR to leverage the build directory of a local crate to improve dependency compile times?

    opened by Wulf 4
  • Show compiler warnings

    Show compiler warnings

    Evcxr doesn't currently show them if the compilation is successful, and I didn't find any option for enabling warnings, and any issue about that (but sorry if there is and it is a duplicate).

    Warnings are useful, because people can make mistakes in jupyter notebooks as well, and in my usecase (I'm writing a rust tutorial) I want to intentionally trigger a warning and show it to the reader. (I currently workaround it by #[deny] the warning)

    Is there a fundamental limit preventing that? I think an option for enabling them is fine too if they are considered unnecessary noise by default.

    opened by HKalbasi 1
  • Stderr and stdout are mixed in jupyter

    Stderr and stdout are mixed in jupyter


    And rerun it will result in random orders.

    If you run this code in rustc, order will always equal to execution flow (at least in my tests).

    code for rustc:

    fn main() {
        #[derive(Debug, Default)]
        enum Testi {
        let x = Testi::default();
        let x = Option::<Testi>::default();


    [] Some(Testi::default()) = Some(
    opened by HKalbasi 4
Google ❤️ Open Source
An Implementation of the Context Tree Weighting (CTW) Sequence Prediction Algorithm

Context Tree Weighting (CTW) CTW is a lightweight, practical and well performing sequence prediction algorithm discovered by Frans Willems, Yuri Shtar

null 4 Jul 26, 2022
Msgpack serialization/deserialization library for Python, written in Rust using PyO3, and rust-msgpack. Reboot of orjson.[Python]

ormsgpack ormsgpack is a fast msgpack library for Python. It is a fork/reboot of orjson It serializes faster than msgpack-python and deserializes a bi

Aviram Hassan 110 Sep 19, 2022
Practice repo for learning Rust. Currently going through "Rust for JavaScript Developers" course.

rust-practice ?? Practice repo for learning Rust. Directories /rust-for-js-dev Files directed towards "Rust for JavaScript Developers" course. Thank y

Sammy Samkough 0 Dec 25, 2021
A Rust library with homemade machine learning models to classify the MNIST dataset. Built in an attempt to get familiar with advanced Rust concepts.

mnist-classifier Ideas UPDATED: Finish CLI Flags Parallelize conputationally intensive functions Class-based naive bayes README Image parsing Confusio

Neil Kaushikkar 0 Sep 2, 2021
A Rust machine learning framework.

Linfa linfa (Italian) / sap (English): The vital circulating fluid of a plant. linfa aims to provide a comprehensive toolkit to build Machine Learning

Rust-ML 1.9k Sep 25, 2022
Machine Learning library for Rust

rusty-machine This library is no longer actively maintained. The crate is currently on version 0.5.4. Read the API Documentation to learn more. And he

James Lucas 1.2k Sep 24, 2022
Rust library for Self Organising Maps (SOM).

RusticSOM Rust library for Self Organising Maps (SOM). Using this Crate Add rusticsom as a dependency in Cargo.toml [dependencies] rusticsom = "1.1.0"

Avinash Shenoy 23 Jul 9, 2022
Rust language bindings for TensorFlow

TensorFlow Rust provides idiomatic Rust language bindings for TensorFlow. Notice: This project is still under active development and not guaranteed to

null 3.9k Sep 26, 2022
Machine learning crate for Rust

rustlearn A machine learning package for Rust. For full usage details, see the API documentation. Introduction This crate contains reasonably effectiv

Maciej Kula 535 Sep 5, 2022
Rust bindings for the C++ api of PyTorch.

tch-rs Rust bindings for the C++ api of PyTorch. The goal of the tch crate is to provide some thin wrappers around the C++ PyTorch api (a.k.a. libtorc

Laurent Mazare 1.9k Sep 29, 2022
个人的 rust 学习资料

?? 通知: 项目文档迁移到: learning-rust-zh 个人的 rust 学习资料 学习目录 目录 源代码地址 相关解析 第一个rust程序

Jarvib Ding 16 Jun 21, 2022
Distributed compute platform implemented in Rust, and powered by Apache Arrow.

Ballista: Distributed Compute Platform Overview Ballista is a distributed compute platform primarily implemented in Rust, powered by Apache Arrow. It

Ballista 2.3k Sep 21, 2022
Tensors and differentiable operations (like TensorFlow) in Rust

autograd Differentiable operations and tensors backed by ndarray. Motivation Machine learning is one of the field where Rust lagging behind other lang

Ryo ASAKURA 389 Sep 19, 2022
Rust numeric library with R, MATLAB & Python syntax

Peroxide Rust numeric library contains linear algebra, numerical analysis, statistics and machine learning tools with R, MATLAB, Python like macros. W

Tae Geun Kim 329 Sep 27, 2022
A fast, safe and easy to use reinforcement learning framework in Rust.

RSRL (api) Reinforcement learning should be fast, safe and easy to use. Overview rsrl provides generic constructs for reinforcement learning (RL) expe

Thomas Spooner 134 Sep 16, 2022
Neural networks in Rust

deeplearn-rs Deep learning in Rust! This is my first shot at this. It's mostly just a proof of concept right now. The API will change. Status We have

Theodore DeRego 198 Sep 7, 2022
A deep learning library for rust

Alumina An experimental deep learning library written in pure rust. Breakage expected on each release in the short term. See in examples or R

zza 95 Sep 16, 2022
Machine learning in Rust.

Rustml Rustml is a library for doing machine learning in Rust. The documentation of the project with a descprition of the modules can be found here. F

null 53 Sep 16, 2022
Rust based Cross-GPU Machine Learning

HAL : Hyper Adaptive Learning Rust based Cross-GPU Machine Learning. Why Rust? This project is for those that miss strongly typed compiled languages.

Jason Ramapuram 84 Sep 15, 2022