# Trouble with using PyROOT

**URL:** <https://root-forum.cern.ch/t/trouble-with-using-pyroot/58089>\
**Category:** Newbie\
**Tags:** python, root\
**Created:** [February 7, 2024, 12:03pm UTC](https://root-forum.cern.ch/t/trouble-with-using-pyroot/58089 "2024-02-07T12:03:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![s\_m](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@s\_m](https://root-forum.cern.ch/u/s_m)\
**Post date:** [February 7, 2024, 12:03pm UTC](https://root-forum.cern.ch/t/trouble-with-using-pyroot/58089/1 "2024-02-07T12:03:49Z")

</div>

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

```auto
"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:

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [February 7, 2024, 1:49pm UTC](https://root-forum.cern.ch/t/trouble-with-using-pyroot/58089/2 "2024-02-07T13:49:38Z")

</div>

Welcome to the ROOT forum

How have you installed ROOT ?

---

<div class="post-metadata">

**Author:** ![s\_m](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@s\_m](https://root-forum.cern.ch/u/s_m)\
**Post date:** [February 7, 2024, 2:33pm UTC](https://root-forum.cern.ch/t/trouble-with-using-pyroot/58089/3 "2024-02-07T14:33:39Z")

</div>

yes, I have installed root, the version is 6.30.2

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [February 7, 2024, 2:48pm UTC](https://root-forum.cern.ch/t/trouble-with-using-pyroot/58089/4 "2024-02-07T14:48:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![s\_m](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@s\_m](https://root-forum.cern.ch/u/s_m)\
**Post date:** [February 7, 2024, 3:24pm UTC](https://root-forum.cern.ch/t/trouble-with-using-pyroot/58089/5 "2024-02-07T15:24:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [February 7, 2024, 3:30pm UTC](https://root-forum.cern.ch/t/trouble-with-using-pyroot/58089/6 "2024-02-07T15:30:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [February 7, 2024, 3:32pm UTC](https://root-forum.cern.ch/t/trouble-with-using-pyroot/58089/7 "2024-02-07T15:32:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![s\_m](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@s\_m](https://root-forum.cern.ch/u/s_m)\
**Post date:** [February 7, 2024, 3:50pm UTC](https://root-forum.cern.ch/t/trouble-with-using-pyroot/58089/8 "2024-02-07T15:50:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vpadulan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vpadulan/32/25315_2.png) [@vpadulan](https://root-forum.cern.ch/u/vpadulan)\
**Post date:** [April 10, 2024, 2:29pm UTC](https://root-forum.cern.ch/t/trouble-with-using-pyroot/58089/9 "2024-04-10T14:29:40Z")

</div>

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:

```auto
$: 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](https://root.cern/install/#conda)

Cheers,  
Vincenzo
