From my Ubuntu terminal, I can run both python (2.7.6, default for Ubuntu 14.04) and root (6.06/00) simply by typing “python” and “root” without any issues.
However, I cannot import root from my python–whether it be in the terminal or any other python files that try to import root. I get:
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named root
I tried following wlav.web.cern.ch/wlav/pyroot/installation.html, but did not really help. On my Ubuntu, all the environment variables PYTHONPATH, ROOTSYS, PYTHONDIR, and LD_LIBRARY_PATH are empty. I tried setting them to the relevant directories, but I still could not import root from python. My path variable, by default, is:
scheong@scheong-Inspiron-7347:~$ echo $PATH
Should ROOTSYS and PYTHONDIR variables be where my python and root are?
Do you have any specific guides to properly set up the environment variables? Or, is there any easier way to import root from python?
Note: it should be “import ROOT”.
See: Import ROOT error
I’ve already tried import ROOT, same issue.
[quote=“Pepe Le Pew”]Note: it should be “import ROOT”.
I tried checking the root config. It does have Python in the features, and I do get yes when I try root-config --has-python.
In order to set all relevant system variables, execute for [bdkz][a]sh:
or for [t]csh:
[quote=“Pepe Le Pew”]In order to set all relevant system variables, execute for [bdkz][a]sh:
or for [t]csh:
source /path/to/root/bin/thisroot.sh solved the problem; it left me with a question, however.
I ran the exact same lines manually, trying to setup the environment variables as required, and I was still having issues. thisroot.sh file seems to do nothing more than that: setting up the environment variables.
Is there any difference between manually editing the environment variables using export ROOTSYS= blah blah and whatnot, and running source thisroot.sh?
No difference whatsoever.
My professor said the same thing.
Either some weird coincidence of other bugs/errors didn’t make it work when I tried it manually, or I guess I typed in the wrong directories.
Anyways, I think everything is good (at least for now).