Using PyROOT in Ubuntu 14.04

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?

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”.
See: https://root-forum.cern.ch/t/import-root-error/14636/2[/quote]

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:
. /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?

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).

Thanks!