Jupyter Notebook ModuleNotFoundError

Hello , I am trying to import ROOT on a Jupiter notebook but I get the following error:
ModuleNotFoundError: No module named ‘libROOTPythonizations3_8’. Have you got any idea on how to solve it ?

_ROOT Version: 6.22.02
_Platform: MacOS
_Compiler:g++


@etejedor may help you.

Hello,

It looks like the PyROOT in your ROOT installation was not compiled for Python3.8.

Could you check what python version is supported by your ROOT with:

root-config --python-version
root-config --python2-version
root-config --python3-version

2.7.16
2.7.16
2.7.16

It seems then that your ROOT installation has only been built for Python2.7.16. When starting Jupyter, please make sure you use a Python2 Jupyter kernel (the one you are using now seems to be Python3.8).

I have tried but it gives me another error:
ImportError: No module named ROOT

This other error indicates that Python does not find the ROOT module. For that purpose, please do source $ROOTSYS/bin/thisroot.sh, where $ROOTSYS is your ROOT installation dir, and then from the same terminal session run jupyter again.

Done! It gives me :
ModuleNotFoundError: No module named ‘libROOTPythonizations3_8’

That’s the first error you reported, please make sure the Jupyter kernel that runs is Python2.

If I run Jupiter from the same session the kernel is automatically python3

You don’t have the python2 Jupyter kernel installed. You need to run, for example:

python2 -m pip install ipykernel

I got that all the requirements are already satisfied

Does

jupyter kernelspec list

list your Python2 kernel? If not, you need to make sure it’s installed and Jupyter sees it.

No it is not but I don’t know how to be sure that Jupyter sees it

Please check the Jupyter docs for installing kernels:

https://jupyter.readthedocs.io/en/latest/install/kernels.html

I have now installed python 2 and the error is:
ImportError Traceback (most recent call last)
in ()
----> 1 import ROOT

/Applications/root_v6.22.02/lib/ROOT/init.py in ()
26 environ[‘CPPYY_NO_ROOT_FILTER’] = ‘1’
27
—> 28 import cppyy
29
30 # import libROOTPythonizations with Python version number

ImportError: No module named cppyy

Hello,
This is probably another problem in the environment that you are using - looks like some problem with the ROOT installation this time, since cppyy should definitely be there.

May I suggest to install and use ROOT via conda? That way the environment you’ll use will be more under control:

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