ROOT's kernel does not appear in Jupyter (macOs)

Hello everyone,

I kind of new with ROOT but I need it for a class and my teacher has never seen this kind of problem (which seems not new here) , root is functional for me in my terminal it works, python also recognizes it but Jupyter notebooks and Jupyter-lab won’t. I’ve seen the different previous topics here on this forum but none of them worked for me.
I’m a newbie and I don’t really know what to do, so if anyone has any ideas on what I should do I’ll be grateful !

Best regards,

Louis

_ROOT Version: 6.26/06
_Platform: MacOs
Compiler: Not Provided


Hi @Louis_phys,

How are you spawning Jupyter notebook? The most straightforward way is to do

$ root --notebook

Cheers,
J.

Thanks for your answer, yes I also tried this but here is what I get:

Ps usually I either use the jupyter-lab command or jupyter notebook one in my terminal.

Could you confirm that importing the ROOT module in a standalone Python session as in

$ python
>>> import ROOT
>>>

works?

Yes it works, to be even clearer , whenever I copy the code from a .ipynb into a .py file and run it and it works perfectly that’s what is really weird…

Which Python version are you using when it works (on the command line)?

This is Python 3.10.9

Ps: I tried to uninstall Jupyter and reinstall it (through homebrew and pip3), I’ve done the same thing for root (with brew) and I was thinking of doing the same thing for python but I’m not sure this would help.

That’s the issue. The ROOT distribution that you are using was built for Python 3.10 (and hence it works on the command line). However, your installation of Jupyter notebook seems to be using Python 3.9, which tries to load the corresponding module for that version (libcppyy3_9), which fails.

The easiest solution I can think of is to use Conda to install a ROOT distribution together with Jupyter that use the same Python version. Please, take a look at Installing ROOT - ROOT for instructions.

Maybe @vpadulan or @etejedor know of any other better/faster workaround.

Cheers,
J.

Very weird that root --notebook still spawns a jupyter instance with a different Python version than the one used to install ROOT. In any case, I have nothing to add, your environment should be coherent and have the same Python version for all packages you use (irrespectively of ROOT tbh).

If conda is too slow, try using mamba as a faster alternative.
Cheers,
Vincenzo

Okay thanks so what should I do exactly ? Uninstall python and reinstall it with mamba ?

There are no other ways to have the Jupyter version that is linked with python 3.10 ?

Hi @Louis_phys,

Here’s a small self-contained example of how to setup a working conda environment with mamba (you can add jupyter in the mamba create line:

As for other ways, I would suppose reinstalling Jupyter in the same Python environment of your ROOT installation should fix the issue. I don’t know the brew command for it. If you install ROOT via brew, I suppose you should also install Jupyter via the same command and not mix it with other Python executables

Cheers,
Vincenzo

Okay thanks, yes I think that I’ll need to look on how to properly uninstall everything from jupyter and reinstall it properly with brew even if I already tried it but it seems like I’ve done it wrong.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.