Towards a better Jupyter kernel - and integration in the JupyterLite ecosystem

Jupyter maintainer here. People on my team have been iterating lately on a Jupyter kernel for GNU Octave called xeus-octave, which was started by Giulio Girardi, and is now being pushed forward by Antoine Prouvost.

We have a few goals for that project

  • making GNU Octave a first-class citizen of the Jupyter ecosystem, with a kernel implementation that does not depend on the Python runtime.
  • providing a WASM build that we could use with JupyterLite, and therefore scale to a very large number of users.
  • adding support for Jupyter interactive widgets.

We would love to get in touch with some folks on the GNU Octave side to discuss various subjects, including some questions on the C++ API, some package management questions, graphics backends, etc.

5 Likes

Hi @SylvainCorlay, I am not an Octave maintainer nor the right person to discuss the technicalities of this but I would love to see this project happening - I would definitely make use of it.

In the past, I tried to look at how Jupyter widgets were defined but couldn’t find a suitable documentation: do you know where I could look into to better understand how they work and implement new ones?

Absolutely, the general documentation of ipywidgets is quite extensive. We also have a 4-hours tutorial on widgets that is available on youtube from SciPy 2020. It is updated every year.

On the xeus-octave side, since most of the jupyter widgets logic lies in the front-end, we will probably wrap xwidgets into octave to make it available in this environment.

3 Likes

tagging @Abdallah_Elshamy . he did a GSOC project on setting up the octave kernel for Jupyter.

Thanks, will look into it!

Concerning WASM, I’m aware of this:

Hello,

I did a GSoC project (mentored by @siko1056) with this Octave kernel for Jupyter. The goal of the project was to run and fill Jupyter notebooks within GNU Octave.

Making GNU Octave a first-class citizen of the Jupyter ecosystem without depending on the Python runtime is absolutely great! I remember that it is some what tricky to setup and configure the Octave kernel for Jupyter.

I am not an expert here. But, I would like to help with that!

2 Likes

We have made some good progress on the xeus-octave kernels, which can already be used on Binder: Run on Binder.

Before we get into more advanced features, we would love to chat with Octave folks about some of the rough edges we came across - mostly around the various ways in which we link with OpenGL implementations, and how they are selected.

4 Likes

That is looking really nice. I really like it. :+1:

This forum is probably a good place to ask those questions.

Very nice! I tried the Binder link: I was able to open a terminal, pip install sympy then octave then pkg install -forge symbolic. After this the Symbolic examples in the Notebook worked OOTB! (Probably someone who knows more about .ipynb would be able to do the pip command from inside a cell).

That’s very nice indeed! The plotly backend is exactly what I was looking for.

Tell me if I should rather open an issue on xeus-octave but I was trying to use this new kernel as a replacement from the calysto one and I run into an issue when trying to compile some files (using Octave’s mkoctfile) in .binder/postBuild

mkoctfile --mex myfile.c
sh: 1: /home/conda/feedstock_root/build_artifacts/octave_1663939771504/_build_env/bin/x86_64-conda-linux-gnu-cc: not found

I presume this is due to the conda environment as, otherwise, build-essential and liboctave-dev were installed through apt.txt but I don’t manage to find my way around.

EDIT: As a workaround, I managed to compile by explicitly defining:

export CC=gcc
export CXX=g++
export CPATH=/srv/conda/envs/notebook/include/octave-7.2.0/octave/

My next issue was that the path (path()) from Octave called from postBuild was empty so nothing could be executed.

octave --no-gui --eval “addpath (…); savepath ();”

This was less of an issue as I could run the installation command at the beginning of the notebook. My old notebook then ran through successfully. Image display does not work yet with the plotly backend but it’s otherwise very good to see this happening.

Hi All,

The binder should now be updated to work as expected including the required custom Octave packages.

Note: the way to go about the compilation is to actually install the conda package for the compiler cxx-compiler.

I am looking into making octave packages on conda-forge. Is this something that would be of interest to people on this thread?

2 Likes

Certainly it would be of interest, many thanks for your efforts in making a better integration of jupyter and octave.

Currently I was working with jupyter and octave but with the calysto kernel in making some notebooks, and was working in both Linux and Windows systems, the best form to organize everything for me was to use conda enviroments, in windows i use normal octave installation while in Linux installed octave and other tools through conda package manager, and mostly everything I need comes from conda-forge channel.

When handling a notebook in both systems, I noticed that some of the octave packages I use were available in Windows, which has most of the packages already preinstalled, but this wasn’t the case in the Octave that is installed in conda enviroment through conda-forge, to solve that I had to install the conda compilers package, then the octave forge packages could finally build, but when looking for this solution, I saw that some people that use Octave through conda in MacOS systems, report that they aren’t capable of installing/building the contents of Octave packages to add them to their conda Octave installation.

And it’s always good to have more tools like this to extend octave functionalities and availability for current or new packages.

I recommend reading the oficial ipywidgets documentation

https://ipywidgets.readthedocs.io/en/8.0.2/index.html

and I was also investigating this package

https://github.com/jupyter-widgets/widget-cookiecutter

to get a most structured form of a project for the files required to put togheter a widget.

but when investigating I read in a jupyterblog article that:

The Python kernel is the reference implementation of the Jupyter protocol and remains the most featureful. We should also mention QuantStack’s Xeus, a native C++ implementation of Jupyter kernel protocol, which supports interactive widgets. Xeus is used as the foundation for the support of Jupyter widgets for the R and C++ kernels.

So for octave probably the way to go is to implement

https://github.com/jupyter-xeus/xwidgets

as pointed by SylvainCorlay

Thanks for the extremely useful project. Can it support Java to use Octave-Java interface?

javaObject (“java.math.BigDecimal”, 1.001 );

Execution exception: javaObject: support for Java was unavailable or disabled when Octave was built

xeus-octave has not limitation wrt the octave-java interface. The octave conda package on conda-forge does not include the Java bindings.

If you would like to include it, please contribute it to the octave conda-forge recipe.

That sounds good. I will look into the conda-forge recipe.