Failed to import libcppyy3_7. Please check that ROOT has been built for Python 3.7

Hello,
I am new to ROOT. I want to import ROOT on the root --notebook, but I am having this error.

 63             'Failed to import {}. Please check that ROOT has been built for Python {}.{}'.format(

—> 64 libcppyy_mod_name, major, minor))
65
66 # ensure ‘import libcppyy’ will find the versioned module

ImportError: Failed to import libcppyy3_7. Please check that ROOT has been built for Python 3.7

my python version is 3.8.10 (obtained after “root-config --python-version”)
I do not understand Where am I missing. can anyone please help me?

_ROOT Version:_6.22.02
Platform: Ubuntu20.04
Compiler: Not Provided


Hello,

It seems that the ipykernel for Jupyter that you have installed is for Python3.7, which is what runs in your notebook. But your ROOT has been built for Python3.8 and this causes a mismatch.

You need to make sure you install ipykernel for Python3.8, so that you run Python3.8 in the notebook.

1 Like

You can probably also just edit the configuration for Jupyter (/usr/share/jupyter/kernels/python3/kernel.json) to use Python3.8 if it’s also installed for that version on your system.

1 Like

Hello,
Thanks for the reply. I have this (/usr/share/jupyter/kernels/python3/kernel.json):
{
“argv”: [
“/usr/bin/python3”,
“-m”,
“ipykernel_launcher”,
“-f”,
“{connection_file}”
],
“display_name”: “Python 3”,
“language”: “python”
}
Can you help me where to make changes?

Post the output from:

ls -al /usr/bin/python3
/usr/bin/python3 --version

I am still getting the same error.

lrwxrwxrwx 1 root root 9 Jul 19 17:54 /usr/bin/python3 → python3.8

Python 3.8.10,

Thank you,

You are not using conda, are you?

@Wile_E_Coyote
No, I am not using Conda.

Thanks

Can you confirm that the Python version you use in the notebook is 3.7? It’s strange, since the kernel.json seems to point to 3.8.

To be completely sure that’s the kernel.json that is being used, can you modify it like so:

 “argv”: [
“/usr/bin/python3.8”,

and launch jupyter again?

Also it would be useful to see the output of:

jupyter kernelspec list

You are not using snap, are you: which jupyter

@etejedor I have changed but still showing the same error.

I am obtaing this:
Available kernels:
root /home/sraj/Cern_Root/root-6.22.02/root-install/etc/notebook/kernels/root
python3 /home/sraj/.local/share/jupyter/kernels/python3

Thank you,

Can it be that you are not using the standard system provided jupyter?

Try:

which jupyter
ls -la /home/sraj/.local/share/jupyter/kernels/python3
cat /home/sraj/.local/share/jupyter/kernels/python3/kernel.json
1 Like

It seems that your kernel.json is here then:

 /home/sraj/.local/share/jupyter/kernels/python3

Probably because ipykernel was installed with --user. You can change /home/sraj/.local/share/jupyter/kernels/python3/kernel.json and make it point to python3.8 as I showed in my previous post.

@Wile_E_Coyote @etejedor
Thank you so much for your help and reply, Sir.

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