General PyRoot Information

Hi,

I looked on the ROOT site about what PyRoot was, and I am still a little bit confused. How is PyRoot different from Root? If I downloaded a binary for Root, do I only need to import it to the python environment I use, then it should be working?

Also, what is the CINT interpreter?

Thx

Hi,

yes: you just need to “import ROOT” to access the entire set of classes of ROOT (and yours, too!) from Python.
Since you have also additional questions, I propose you visit our “Getting Started” section: root.cern.ch/getting-started

Cheers,
Danilo

I tried that with some sample code and the shell says there is no module named root. Should I try saving the distribution of Root I have somewhere else?

Hi,

Is the root envirnment properly set? Do you see the ROOT.py file in the lib directory of ROOT?

Cheers,
Danilo

Yes it is

Are you sure you typed

. your/root/dir/bin/thisroot.sh

?
What is the content of the $PYTHONPATH variable?

looks like its not set to anything. What should I set it to?

Hi,

did you run the command above with the proper dir structure?

D

I believe so

This is odd.
The script sets that variable: github.com/root-mirror/root/blo … hisroot.sh

Could you double check?

D

I ran the script in Terminal, and the path is now @libdir@. However I still get the same import error, claiming there is no module named ROOT. Also when I quit out of Terminal and restart it, it says the pythonpath variable is not set to anything.

Also, maybe I am trying to import it incorrectly. This is the script I am trying to run: from ROOT import gROOT, TCanvas, TF1.

What do you mean by @libdir@? A full path? If yes, is it the correct one, i.e. the one containing all root li raries and the ROOT module, i.e. the ROOT.py file?
The setup of the environment is of course not correctly set once opening a other terminal.
PYTHONPATH needs to be set for the ROOT module to be inportable.