ROOT C++ notebook inside vscode


I would like to run the Jupyter notebook with a ROOT C++ kernel inside vscode. I saw that vscode allows one to chose a kernel, but I cannot see the ROOT C++ kernel in my list of dropdown kernels (screenshot below)

I searched around and found that it is possible to use kernels other than the python kernel with Jupyter inside vscode. Could someone please help me with setting up vscode so that I can use Jupyter with the ROOT C++ kernel ?

I find vscode very useful, especially after realizing that we can use the ROOT File viewer extension to preview ROOT files inside vscode. Many thanks to the developers for enabling this feature !

ROOT Version: 6.24/06
Platform: Linux Mint


When you run root --notebook to start a Jupyter notebook server with the ROOT C++ kernel, that kernel is stored on your home directory (in ~./rootnb). Perhaps you could make VS aware of that? If you source $ROOTSYS/bin/ in a terminal, it will configure jupyter variables that point to the ROOT C++ kernel. Maybe VS reads those variables too (JUPYTER_PATH, JUPYTER_CONFIG_DIR).

A possible workaround might also be to add a symlink to the directory in which VSCode looks for kernels (likely one of the default jupyter dirs) to ~/.rootnb.


Thanks for your quick replies ! I am still a novice with using ROOT and VSCode and am not really sure how to let VSCode know about the ROOT kernels. I tried hunting about on other forums (StackExchange and VSCode github extension pages), but could not figure it out.

I did find an ugly hack which worked. I basically started root --notebook and then noted the jupyter server url. I fed this url into VSCode (as shown in the screenshot below) and then could select ROOT C++ from the list of drop down kernels.

Which basically means that I should be able to get this working if I can figure out how to tell VSCode the location of the ROOT C++ kernel.

Thanks a lot for your help though. If any of you know how to tweak the settings on VSCode, please do let me know. I guess I will also ask around on their forums for more information. Until then, I will use my hacky solution :slight_smile: Thanks again.