ROOT and jupyter notebook on visual studio code


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hello,
I am having some problems using ROOT with ipython and jupyter notebooks under windows.
Premise:
I have installed the latest available version of ROOT, 6.28.04.
The idea is to use ROOT with jupyter notebooks in visual studio code, because it is an editor accessible to screen readers, while jupyter’s native editor is not.

Steps:
I installed python 3.8 in a virtual environment, which I called pyroot; on my system I have python 3.10.
I installed jupyter and ipython in the virtual environment.
I then copied the folder containing the json file with the kernel specification to the “share” directory in my virtual environment.
I changed the executable from python3.8 to d:\projects\pyroot\scripts\python in the json file.
I added c:\root\bin to the PYTHONPATH environment variable.

Results:
in visual studio code I created a new notebook and selected the rootkernel.
When I try to change the cell language from pythona C++, the system does not detect C++ as an available language for the cell; the C/C++ extension is installed.
Running the cell with simple c++ code, nothing happens; it seems that the kernel does not respond.
I also tried running rootnb.exe --no-browser and copying the URL, but the result is the same.

IPython:
I imported ROOT into ipython, all ok.
I tried typing:
%%cpp
c++ code;

The system returns an error: %%cpp magic not found.

At this point I have two options:

  1. ROOT and python do not work under windows.
  2. Some module is missing that I should install, but I don’t know what to look for; google is not helping me.

Any ideas?
Thanks!
Germano

Right, in Jupyter notebooks the c++ kernels fail to start on Windows. We’ll investigate.

FYI there is a Pull Request addressing this issue