Trouble with using PyROOT

Hi,
I am trying to use PyROOT. so, after running “python” then “import ROOT” command I am getting an error saying:

"ImportError: Failed to import libcppyy3_11. Please check that ROOT has been built for Python 3.11"

I have installed all the required pacakges(required+most common optional) sucessfully.
Is there something else I am missing?
Thanks for any suggestion for solving this issue.

Cheers!

ROOT Version:6.30.2
Platform: ubuntu 22.04.3 LTS
Compiler:

Welcome to the ROOT forum

How have you installed ROOT ?

yes, I have installed root, the version is 6.30.2

you compiled it from the sources or you installed it from a precompiled distribution ?
What is the python version on your machine ?

Hi,
I am very new to this stuffs. I will try to provide you a details picture of what I did.

The python version version on my machine is 3.11.5.

To install root I used pre-compiled binary distribution and I follwed this procedure:
→ Installed all required dependencies with the optionals also
→ downloaded the file the website (the version of root I am using - [Release 6.30/02 - 28 Nov 2023])

→ extracted the pacakage at “home” directory

then I ran the follwing commands:
→ cd root/bin
→ source thisroot.sh

As, I had to excecute above two command everytime I wanted to use root, I ran:
→ echo “. ~/root/bin/thisroot.sh” >> ~/.bashrc

What you are doing seems fine. As it seems to be a python issue let’s see if @vpadulan can help.

One more check: did you download the ROOT package specific to your OS (Ubuntu 22.04 as per your first post)?

Sorry, I did not understand your question. But, I will tell you what I did.

In the website(as a newbie, I can not share link!) where the packages are listed, first I chose the version(in my case root-6.30.2) , and then I choose ubuntu 22.04. If it is any helpful the package name is: “root_v6.30.02.Linux-ubuntu22.04-x86_64-gcc11.4.tar.gz”

I don’t know if you are asking for this.

Dear @s_m ,

Thanks for reaching out and sorry for the late reply. I can confirm the pre-compiled binaries work on a ubuntu 22.04 docker container:

$: apt-get install binutils cmake dpkg-dev g++ gcc libssl-dev git libx11-dev \
libxext-dev libxft-dev libxpm-dev python3 gfortran libpcre3-dev \
xlibmesa-glu-dev libglew-dev libftgl-dev \
libmysqlclient-dev libfftw3-dev libcfitsio-dev \
graphviz-dev libavahi-compat-libdnssd-dev \
libldap2-dev python3-dev python3-numpy libxml2-dev libkrb5-dev \
libgsl0-dev qtwebengine5-dev nlohmann-json3-dev wget
$: wget https://root.cern/download/root_v6.30.02.Linux-ubuntu22.04-x86_64-gcc11.4.tar.gz
$: tar -xf root_v6.30.02.Linux-ubuntu22.04-x86_64-gcc11.4.tar.gz
$: source root/bin/thisroot.sh
$: python3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> 

Most definitely the reason you are not able to run ROOT from a Python session is that you are not using the system Python version for your distribution. As you can see from above, the Python version on ubuntu 22.04 is 3.10.12 and our binaries are compiled for that version. As an alternative, you can create simply a conda environment if you want a different Python version. See Installing ROOT - ROOT

Cheers,
Vincenzo

1 Like