# \#python3

**URL:** https://root-forum.cern.ch/tag/python3/38.md

[Latest](https://root-forum.cern.ch/latest.md) · [Categories](https://root-forum.cern.ch/categories.md) · [Tags](https://root-forum.cern.ch/tags.md)

---

## [PyROOT tries to import \`.so\` instead of \`.dylib\` on macos](https://root-forum.cern.ch/t/pyroot-tries-to-import-so-instead-of-dylib-on-macos/64533)

<div class="topic-metadata">

**Author:** [@kratsg](https://root-forum.cern.ch/u/kratsg)\
**Replies:** 1\
**Last updated:** [December 10, 2025, 6:46pm UTC](https://root-forum.cern.ch/t/pyroot-tries-to-import-so-instead-of-dylib-on-macos/64533 "2025-12-10T18:46:16Z")

</div>

This impacts 6.32.10, 6.34.10, 6.36.04, and 6.36.06 (so I think it’s pretty independent of root but maybe configuration related). For ROOT experts, what is triggering the loading of a shared library (as in what determine…

---

## [Problem to import ROOT in python3.12](https://root-forum.cern.ch/t/problem-to-import-root-in-python3-12/61661)

<div class="topic-metadata">

**Author:** [@dlin](https://root-forum.cern.ch/u/dlin)\
**Replies:** 3\
**Last updated:** [September 14, 2024, 7:18am UTC](https://root-forum.cern.ch/t/problem-to-import-root-in-python3-12/61661 "2024-09-14T07:18:50Z")

</div>

Dear Experts: I recently updated my system from Ubuntu 22.04 to 24.04, and recompile ROOT 6.28/06. However, the python3 was also updated accordingly to Python 3.12.3. Then when I use ROOT in python by “import ROOT”, got…

---

## [Scatter plot (with colorbar) in pyroot](https://root-forum.cern.ch/t/scatter-plot-with-colorbar-in-pyroot/39214)

<div class="topic-metadata">

**Author:** [@LCC](https://root-forum.cern.ch/u/LCC)\
**Replies:** 9\
**Last updated:** [September 5, 2024, 1:39pm UTC](https://root-forum.cern.ch/t/scatter-plot-with-colorbar-in-pyroot/39214 "2024-09-05T13:39:46Z")

</div>

Hi! This is my first post here, so excuse me if it is a repeated question (although I searched for similar posts). I am completely new with Root, and I started learning it with with pyroot. Right now, my project consis…

---

## [Pyroot not enabled in root](https://root-forum.cern.ch/t/pyroot-not-enabled-in-root/60613)

<div class="topic-metadata">

**Author:** [@camillaberti](https://root-forum.cern.ch/u/camillaberti)\
**Replies:** 3\
**Last updated:** [August 27, 2024, 11:27am UTC](https://root-forum.cern.ch/t/pyroot-not-enabled-in-root/60613 "2024-08-27T11:27:58Z")

</div>

Hi! I installed root using the build from source option, but it seems that something went wrong with pyroot, here’s what I tried to do: I wrote python3 import ROOT and I got this error: Traceback (most recent call …

---

## [How can i custom my histogram style with two curves?](https://root-forum.cern.ch/t/how-can-i-custom-my-histogram-style-with-two-curves/54640)

<div class="topic-metadata">

**Author:** [@sergio\_fernandez](https://root-forum.cern.ch/u/sergio_fernandez)\
**Replies:** 3\
**Last updated:** [April 26, 2023, 11:28am UTC](https://root-forum.cern.ch/t/how-can-i-custom-my-histogram-style-with-two-curves/54640 "2023-04-26T11:28:03Z")

</div>

Hello I’m try to plot some overlaid histograms. how can i set the style that i show in the attached image? h1.SetLineColor(?) h1.SetLineWidth(?) h1.SetMarkerSize(?) h2.SetLineColor(?) h2.SetLineWi…

---

## [Google Colab ROOT import](https://root-forum.cern.ch/t/google-colab-root-import/54220)

<div class="topic-metadata">

**Author:** [@drawal](https://root-forum.cern.ch/u/drawal)\
**Replies:** 2\
**Last updated:** [March 29, 2023, 1:44pm UTC](https://root-forum.cern.ch/t/google-colab-root-import/54220 "2023-03-29T13:44:38Z")

</div>

Hi all, I’m trying to set up ROOT in a Google Colab environment, by installing a pre-compiled binary distribution. First, I’m finding the system information by running !lsb\_release -a, which returns the following: No…

---

## [Difficulty importing ROOT in Python](https://root-forum.cern.ch/t/difficulty-importing-root-in-python/53784)

<div class="topic-metadata">

**Author:** [@drawal](https://root-forum.cern.ch/u/drawal)\
**Replies:** 3\
**Last updated:** [February 27, 2023, 5:09pm UTC](https://root-forum.cern.ch/t/difficulty-importing-root-in-python/53784 "2023-02-27T17:09:09Z")

</div>

Hi all, I’m trying to import ROOT so that I can use it in a python file in VS Code. The Python file contains the following code: import sys, os sys.path.append("/Applications/root\_v6.28.00/") sys.path.append("/Applic…

---

## [Incorrect information in jupyROOT 2d histograms](https://root-forum.cern.ch/t/incorrect-information-in-jupyroot-2d-histograms/51547)

<div class="topic-metadata">

**Author:** [@sarthchoudhary](https://root-forum.cern.ch/u/sarthchoudhary)\
**Replies:** 6\
**Last updated:** [September 14, 2022, 12:29pm UTC](https://root-forum.cern.ch/t/incorrect-information-in-jupyroot-2d-histograms/51547 "2022-09-14T12:29:09Z")

</div>

The hover information for bin in interactive 2D histograms in jupyter lab (jupyROOT) seems to be pythonic rather than ROOT/C++ (See attached screenshot). Unless, I am mistaken, the first bin in ROOT should be indexed a…

---

## [How to completely blind a region when using RooDataSet.plotOn](https://root-forum.cern.ch/t/how-to-completely-blind-a-region-when-using-roodataset-ploton/51532)

<div class="topic-metadata">

**Author:** [@Patrick\_Wu](https://root-forum.cern.ch/u/Patrick_Wu)\
**Replies:** 2\
**Last updated:** [September 12, 2022, 8:55pm UTC](https://root-forum.cern.ch/t/how-to-completely-blind-a-region-when-using-roodataset-ploton/51532 "2022-09-12T20:55:26Z")

</div>

Dear ROOT experts, I want to plot RooDataSet outside a blinded region, \[120000, 280000\]. Therefore I tried using Range and CutRange. However, ROOT only makes the bins inside the blinded region to be zero. Could you teac…

---

## [Not able to use PyROOT in Python3](https://root-forum.cern.ch/t/not-able-to-use-pyroot-in-python3/48991)

<div class="topic-metadata">

**Author:** [@CaueEvangelista](https://root-forum.cern.ch/u/CaueEvangelista)\
**Replies:** 4\
**Last updated:** [March 1, 2022, 10:44pm UTC](https://root-forum.cern.ch/t/not-able-to-use-pyroot-in-python3/48991 "2022-03-01T22:44:23Z")

</div>

ROOT Version: 6.10/04 OS: Linux Mint Tricia (based on Ubuntu 18.04) Compiler: gcc(and g++) 7.5.0 Python2 version: Python 2.7.17 Python3 version: Python 3.6.9 I’m a user of ROOT and recently I started doing a cours…

---

## [Difficulties on obtaining DNN predictions on PyROOT](https://root-forum.cern.ch/t/difficulties-on-obtaining-dnn-predictions-on-pyroot/48408)

<div class="topic-metadata">

**Author:** [@mrli](https://root-forum.cern.ch/u/mrli)\
**Replies:** 6\
**Last updated:** [January 18, 2022, 10:54am UTC](https://root-forum.cern.ch/t/difficulties-on-obtaining-dnn-predictions-on-pyroot/48408 "2022-01-18T10:54:44Z")

</div>

Hello everyone, I would appreciat it if someone could help me. I have trained a binary classification DNN model and wanted to obtain its confusion matrix on python. So I tried to get the predictions of testing data by…

---

## [2 Pull plots axis labels configuration problems](https://root-forum.cern.ch/t/2-pull-plots-axis-labels-configuration-problems/47094)

<div class="topic-metadata">

**Author:** [@Cesar1](https://root-forum.cern.ch/u/Cesar1)\
**Replies:** 8\
**Last updated:** [October 4, 2021, 2:22pm UTC](https://root-forum.cern.ch/t/2-pull-plots-axis-labels-configuration-problems/47094 "2021-10-04T14:22:26Z")

</div>

Dear experts, I am having some problems with the following plot: mllmassh.pdf (32.4 KB) I named the pads as ax1 (main plot), ax2 (first pull plot), ax3 (second and last pull plot). As you can see, both the main plot y…

---

## [PyROOT: Overloaded constructor not available in derived TFile class](https://root-forum.cern.ch/t/pyroot-overloaded-constructor-not-available-in-derived-tfile-class/46136)

<div class="topic-metadata">

**Author:** [@danielberninghoff](https://root-forum.cern.ch/u/danielberninghoff)\
**Replies:** 2\
**Last updated:** [August 9, 2021, 8:42am UTC](https://root-forum.cern.ch/t/pyroot-overloaded-constructor-not-available-in-derived-tfile-class/46136 "2021-08-09T08:42:55Z")

</div>

Hi all, I am trying to create a new class in PyROOT that inherits from TFile: import ROOT class File(ROOT.TFile): def \_\_init\_\_(self, filename, mode=""): super().\_\_init\_\_(filename, mode) # Advanced func…

---

## [Error while creating subsample from RooDataSet](https://root-forum.cern.ch/t/error-while-creating-subsample-from-roodataset/43086)

<div class="topic-metadata">

**Author:** [@pkalbhor](https://root-forum.cern.ch/u/pkalbhor)\
**Replies:** 4\
**Last updated:** [March 5, 2021, 8:20pm UTC](https://root-forum.cern.ch/t/error-while-creating-subsample-from-roodataset/43086 "2021-03-05T20:20:51Z")

</div>

Hello, Following is the code that takes input as weighted RooDataSet and tries to create a reduced dataset by picking random events from that dataset. import ROOT f = ROOT.TFile("inputfile.root") dataset = f.Get("sigMC…

---

## [Efficiencies with pyROOT](https://root-forum.cern.ch/t/efficiencies-with-pyroot/43527)

<div class="topic-metadata">

**Author:** [@matheus\_macedo](https://root-forum.cern.ch/u/matheus_macedo)\
**Replies:** 1\
**Last updated:** [February 12, 2021, 6:39pm UTC](https://root-forum.cern.ch/t/efficiencies-with-pyroot/43527 "2021-02-12T18:39:47Z")

</div>

I’m trying to calculate muon efficiencies with pyroot. f\_SF\_ID\_BC = ROOT.TFile.Open( “EfficienciesStudies\_2016\_legacy\_rereco\_rootfiles\_RunBCDEF\_SF\_ID.root”) h\_SF\_ID\_BC = ROOT.TH2D() Get\_Object\_f\_SF\_ID\_BC = f\_SF\_ID\_BC…

---

## [Import ROOT in python](https://root-forum.cern.ch/t/import-root-in-python/43139)

<div class="topic-metadata">

**Author:** [@hhggggg1826](https://root-forum.cern.ch/u/hhggggg1826)\
**Replies:** 4\
**Last updated:** [January 18, 2021, 2:33pm UTC](https://root-forum.cern.ch/t/import-root-in-python/43139 "2021-01-18T14:33:15Z")

</div>

Hi, I face a problem when I import ROOT in python. from ROOT import \* And, the error is ImportError: Failed to import libcppyy3\_8. Please check that ROOT has been built for Python 3.8 Is there a new version of ROOT…

---

## [ROOT Classes in Python](https://root-forum.cern.ch/t/root-classes-in-python/42748)

<div class="topic-metadata">

**Author:** [@Skip](https://root-forum.cern.ch/u/Skip)\
**Replies:** 4\
**Last updated:** [December 22, 2020, 4:38pm UTC](https://root-forum.cern.ch/t/root-classes-in-python/42748 "2020-12-22T16:38:46Z")

</div>

Hey, all! I’ve been working in Python 3.x a lot and am in the process of reproducing many functions native to ROOT but in a numpy/pandas format. Most things I’m doing (going over StPico files for STAR analysis) are prett…

---

## [Using vector\<pair\<int\>\> in pyroot](https://root-forum.cern.ch/t/using-vector-pair-int-in-pyroot/41966)

<div class="topic-metadata">

**Author:** [@wx2017](https://root-forum.cern.ch/u/wx2017)\
**Replies:** 1\
**Last updated:** [October 22, 2020, 10:49pm UTC](https://root-forum.cern.ch/t/using-vector-pair-int-in-pyroot/41966 "2020-10-22T22:49:06Z")

</div>

To define a vector\<int\> in pyroot one can do: vec = ROOT.std.vector('int')() Is it possible to use vectors with embedded pair in pyroot, e.g: vector\<pair\<int, float\>\> Thanks

---

## [Problem instaling ROOT 6.23.01 on Mac Catalina 10.15.6](https://root-forum.cern.ch/t/problem-instaling-root-6-23-01-on-mac-catalina-10-15-6/41689)

<div class="topic-metadata">

**Author:** [@Alan\_H](https://root-forum.cern.ch/u/Alan_H)\
**Replies:** 2\
**Last updated:** [October 5, 2020, 10:50am UTC](https://root-forum.cern.ch/t/problem-instaling-root-6-23-01-on-mac-catalina-10-15-6/41689 "2020-10-05T10:50:18Z")

</div>

Hi, I am trying to install ROOT on my Mac Catalina 10.15.6. I already had xQuartz. I am using my Z shell (zsh). I downloaded Cmake (version 3.18.3) using brew install cmake. And then I did: cd /usr/local/ sudo git clone…

---

## [Build Problem with XROOTD on ROOT v6-22-00](https://root-forum.cern.ch/t/build-problem-with-xrootd-on-root-v6-22-00/40255)

<div class="topic-metadata">

**Author:** [@marvin\_littlewood](https://root-forum.cern.ch/u/marvin_littlewood)\
**Replies:** 13\
**Last updated:** [July 30, 2020, 8:27am UTC](https://root-forum.cern.ch/t/build-problem-with-xrootd-on-root-v6-22-00/40255 "2020-07-30T08:27:48Z")

</div>

ROOT Version: v6-22-00 Platform: Linux xubuntu 5.4.0-40-generic #44-Ubuntu SMP Tue Jun 23 00:01:04 UTC 2020 x86\_64 x86\_64 x86\_64 GNU/Linux Compiler: gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0 Hi! Having successfully built …

---

## [Building with external/altinstall python3 cmake error finding python interpreter version 1.4](https://root-forum.cern.ch/t/building-with-external-altinstall-python3-cmake-error-finding-python-interpreter-version-1-4/40431)

<div class="topic-metadata">

**Author:** [@GeoffreyMullier](https://root-forum.cern.ch/u/GeoffreyMullier)\
**Replies:** 1\
**Last updated:** [July 15, 2020, 8:57am UTC](https://root-forum.cern.ch/t/building-with-external-altinstall-python3-cmake-error-finding-python-interpreter-version-1-4/40431 "2020-07-15T08:57:33Z")

</div>

ROOT Version: 6.20.04 Platform: Centos7 Compiler: Devtoolsel7 (gcc 7.3.1) CMake: 3.12 compiled from source Python: 3.8.0 compiled from source Since I couldn’t find the right answer and it took a bit of digging in o…

---

## [Cmake error when trying to compile ROOT with Python 3 support](https://root-forum.cern.ch/t/cmake-error-when-trying-to-compile-root-with-python-3-support/39223)

<div class="topic-metadata">

**Author:** [@LastStarDust](https://root-forum.cern.ch/u/LastStarDust)\
**Replies:** 10\
**Last updated:** [May 7, 2020, 9:25am UTC](https://root-forum.cern.ch/t/cmake-error-when-trying-to-compile-root-with-python-3-support/39223 "2020-05-07T09:25:33Z")

</div>

ROOT Version: 6-20-04 Platform: Scientific Linux 6.10 x86\_64 Compiler: gcc (GCC) 6.3.1 20170216 (Red Hat 6.3.1-3) Python: Python 3.5.7 Hello! I am trying to compile ROOT in a cluster computing server where I have …

---

## [Autocomplete in PyCharm not working](https://root-forum.cern.ch/t/autocomplete-in-pycharm-not-working/37913)

<div class="topic-metadata">

**Author:** [@niltsz](https://root-forum.cern.ch/u/niltsz)\
**Replies:** 7\
**Last updated:** [February 12, 2020, 12:29pm UTC](https://root-forum.cern.ch/t/autocomplete-in-pycharm-not-working/37913 "2020-02-12T12:29:36Z")

</div>

Hey everybody, I’ve been trying for quite some hours now to get code completition working in my PyCharm IDE. I can import PyROOT (as well as rootpy), and I can also run scripts within my IDE, there is just no autocompl…

---

## [pyRoot on pyCharm](https://root-forum.cern.ch/t/pyroot-on-pycharm/37641)

<div class="topic-metadata">

**Author:** [@Ale\_olomorfo](https://root-forum.cern.ch/u/Ale_olomorfo)\
**Replies:** 4\
**Last updated:** [January 20, 2020, 4:32pm UTC](https://root-forum.cern.ch/t/pyroot-on-pycharm/37641 "2020-01-20T16:32:16Z")

</div>

Hello everybody! I’d like to use pyRoot with pyCharm but I have some problems. pyRoot works perfectly when I use it on “standard” linux terminal, but on pyCharm I get the following mistake: Traceback (most recent call…

---

## [pyROOT with Python2 works, pyROOT with Python3 does not](https://root-forum.cern.ch/t/pyroot-with-python2-works-pyroot-with-python3-does-not/37550)

<div class="topic-metadata">

**Author:** [@Ale\_olomorfo](https://root-forum.cern.ch/u/Ale_olomorfo)\
**Replies:** 7\
**Last updated:** [January 20, 2020, 10:58am UTC](https://root-forum.cern.ch/t/pyroot-with-python2-works-pyroot-with-python3-does-not/37550 "2020-01-20T10:58:35Z")

</div>

Hello everybody! I am learning Pyhton and I’d like to use pyRoot but I have a problem: pyRoot works with Python2 but not with Python3. When I use Python2 I get: alessandro@alessandro-X550CC:~/Scrivania$ python Python …

---

## [PyKeras neural network - event-byevent weights](https://root-forum.cern.ch/t/pykeras-neural-network-event-byevent-weights/37338)

<div class="topic-metadata">

**Author:** [@Anshul\_Kapoor](https://root-forum.cern.ch/u/Anshul_Kapoor)\
**Replies:** 0\
**Last updated:** [December 27, 2019, 9:23am UTC](https://root-forum.cern.ch/t/pykeras-neural-network-event-byevent-weights/37338 "2019-12-27T09:23:10Z")

</div>

I am currently trying to train a neural network using a sequential model from Keras but event-by-event weights are not working for me. The signal and background actually only differ in event-by-event weights, the raw di…

---

## [Using pyROOT on Fedora 30](https://root-forum.cern.ch/t/using-pyroot-on-fedora-30/36726)

<div class="topic-metadata">

**Author:** [@Number042](https://root-forum.cern.ch/u/Number042)\
**Replies:** 4\
**Last updated:** [November 11, 2019, 3:40pm UTC](https://root-forum.cern.ch/t/using-pyroot-on-fedora-30/36726 "2019-11-11T15:40:28Z")

</div>

Hi! I installed ROOT from the system repository in Fedora. Now, while trying to use pyROOT for the first time, I encounter an issue as the line import ROOT from a python3 jupyter-notebook instance fails with the follo…

---

## [Problem with RDataFrame::Fill in python](https://root-forum.cern.ch/t/problem-with-rdataframe-fill-in-python/36662)

<div class="topic-metadata">

**Author:** [@simonepigazzini](https://root-forum.cern.ch/u/simonepigazzini)\
**Replies:** 4\
**Last updated:** [November 5, 2019, 9:44am UTC](https://root-forum.cern.ch/t/problem-with-rdataframe-fill-in-python/36662 "2019-11-05T09:44:49Z")

</div>

Hello, I am facing an issue calling the Fill method of an RDataFrame in python, after loading a TTree into the RDataFrame what I do is: hist = ROOT.TH1D("h\_trk\_y", "", 100, -20, 20) filled\_hist = h4df.Fill(test\_h, 'trk…

---

## [Dictionary usage with Python 3](https://root-forum.cern.ch/t/dictionary-usage-with-python-3/36371)

<div class="topic-metadata">

**Author:** [@Attila\_Krasznahorkay](https://root-forum.cern.ch/u/Attila_Krasznahorkay)\
**Replies:** 3\
**Last updated:** [October 16, 2019, 4:13pm UTC](https://root-forum.cern.ch/t/dictionary-usage-with-python-3/36371 "2019-10-16T16:13:45Z")

</div>

Hi, I’ve just run into something that I can’t make heads or tails of… I’m experimenting with a “new compiler” at the moment. I’ve re-built all of my “externals” and all of my own code with this “new compiler”, and am t…
