Applied statistic computing setup:
Setting up python:

Linux/Mac type OS:

Python can be downloaded from the following page:
Note that if you are already a python-person and have version 2.7 or later you can just ignore this step

  • Download python-2.7.5.

    Move the downloaded .tar.xz file to where you want your installation source to be on your computer, and type:
    tar xf Python-2.7.5.tar.xz
    Go to the Python-2.7.5 directory, configure the installation first, and compile:
    ./configure
    sudo make
    You will now need to tell your OS that this is the python installation you want to use since most unix systems comes with a preinstalled python, which is possibly out of date.
    sudo make altinstall
    Test that you have the correct version of python by typing in your terminal. It should say python 2.7.5:
    python --version


    Installing ROOT from source:
    Linux type OS:

    To compile ROOT with the pyROOT interface, you will need to determine where your OS stores the Python.h and libpython2.7.so files. If you don't know where this is, you can figure it out by typing in your terminal:
    sudo find / | grep "Python.h"
    sudo find / | grep "libpython2.7.so"
    Which should give you the corresponding paths, make a note of where these are.
    (On my test I found them in /usr/local/include/python2.7/Python.h and /usr/lib64/libpython2.7.so)
    Download the Root source code from the following page. Choose the 'pro' version (currently 5.34/09).

  • ROOT source code

    Move the tarball to where you want your install directory to be. Untar the package:
    tar -zxvf root_v5.34.09.source.tar.gz
    Go to the folder you have just created and configure the package:
    ./configure --enable-python --with-python-incdir='Path to where you found Python.h' --with-python-libdir='Path to where you found libpython2.7.so' --enable-tmva
    You will most likely get some error messages since your computer will probably not have all the dependencies you need. You can either just install each of the packages you get an error message from and run configure until it works, or go to the prerequisites page, find your OS and install the necessary packages.

  • Build Prerequisites

    Once the configure script has run and given a success exit status, you can compile the package (This will take some time!).
    make
    The last step is to add ROOT to your LD_LIBRARY_PATH. To do this, add
    source 'PATH_TO_WHERE_YOU_COMPILED_ROOT'/bin/thisroot.sh
    To the end of your .bashrc or .bash_login file you can find in your home directory.

    Mac type OS:
    To compile you will need to have the xcode with command line tools installed. You can install xcode from the appstore and command line tools from within xcode:
    xcode
    preferences
    downloads

    Download the Root source code from the following page. Choose the 'pro' version (currently 5.34/09).

  • ROOT source code

    Move the tarball to where you want your install directory to be. Untar the package:
    tar -zxvf root_v5.34.09.source.tar.gz
    Go to the folder you have just created and configure the package:
    ./configure --enable-tmva
    Once the configure script has run and given a success exit status, you can compile the package (This will take some time (~30 minutes on newer macs)!).
    make
    The last step is to add ROOT to your LD_LIBRARY_PATH. To do this, add
    source 'PATH_TO_WHERE_YOU_COMPILED_ROOT'/bin/thisroot.sh
    To the end of your .bashrc or .bash_login file you can find in your home directory.
    Test if root works by typing in your terminal:
    root
    You should enter the root interpreter and a window should pop up saying ROOT, something something.
    Test if pyroot works by typing in your terminal:
    python
    import ROOT
    It you don't get any error message, everything is working fine. You can exit the python enviroment by typing exit() or ctrl+d (i.e. holding control and d and the same time) If it isn't working, then it might be because Python doesn't know where to look for ROOT, and you need to set your environment variables:

    System -> avancerede systemindstillinger -> Miljøvariabler ->
    Under "Brugervariabler" (Eng: "User variables") add new variable:
    "Path" with value: "C:\Python27",
    where "C:\Python27" is the path to your Python installation.

    Under "Systemvariabler" (Eng: "System Variables") edit:
    "PATHEXT" add: ".PY"
    "PATH" add: "%ROOTSYS%/BIN;%PATH%"
    "PYTHONPATH" add: "%ROOTSYS%/BIN;%PYTHONPATH%"




    Note: No worries if you are not able to get it working from home. We will figure it out during one of the computing intro days.