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:
import root
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
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
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?
In order to set all relevant system variables, execute for [bdkz][a]sh:
. /Where/Your/Root/Is/bin/thisroot.sh
or for [t]csh:
source /Where/Your/Root/Is/bin/thisroot.csh
[quote=“Pepe Le Pew”]In order to set all relevant system variables, execute for [bdkz][a]sh:
. /Where/Your/Root/Is/bin/thisroot.sh
or for [t]csh:
source /Where/Your/Root/Is/bin/thisroot.csh[/quote]
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?