TMVAGui in ipython

Dear ROOT support team,

I am trying to get a TMVAGui running in ipython and I am struggling to do so even after some searching. I’m running the ipython version that comes with lxplus, i.e. version 0.13.2 and it uses python 2.6.6.

I found instructions to do the following, since I also cannot run it with the ROOT version that comes with CMSSW:

export ROOTSYS=/cvmfs/sft.cern.ch/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc49-dbg/ export PATH=$ROOTSYS/bin:$PATH

Then I run my script in ipython and from this thread: comments.gmane.org/gmane.comp.la … root/17223 I gather that I could just run this:

import ROOT ROOT.TMVA.TMVAGui('TMVAoutput.root')

but I get the error that TMVA does not have an attribute TMVAGui:

I can see that the TMVAGui library is there in lib/libTMVAGui.so, but I really have no clue on how to start the GUI.

Is there something that I’m missing to include or run?

Thanks in advance,
-marc

Hi Marc,

the setup of the environment is incomplete. Try on lxplus:

 . /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc49-dbg/bin/thisroot.sh 
source /cvmfs/sft.cern.ch/lcg/releases/gcc/4.9.3/x86_64-slc6/setup.sh
export PATH=/cvmfs/sft.cern.ch/lcg/releases/Python/2.7.9.p1-df007/x86_64-slc6-gcc49-opt/bin/:$PATH
$ python
Python 2.7.9 (default, May 13 2015, 19:48:56) 
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> import ROOT
>>> ROOT.TMVA.TMVAGui('TMVAoutput.root')
--- Launch TMVA GUI to view input file: TMVAoutput.root
Error in <TFile::TFile>: file TMVAoutput.root does not exist
==> Abort TMVAGui, please verify filename

I of course do not have the input rootfile but the output demonstrates that the library loads correctly.

Danilo

Hi Danilo,

thanks, that makes it work if I run in python! Running that in ipython still doesn’t work because it loads the wrong python version. I’ll probably install my own version of ipython, if I manage.

Thanks, anyway!
-marc

Hi Marc,

two comments:

  1. I tested TMVA on ROOT 6.04 + ipython setup on an ubuntu machine and it works flawlessly
  2. Setting up the environment a recent CMSSW (pre)release/IB, 8 series, could be the ideal for you.

In addition, even this is not really a ROOT issue but more a configuration one, I will come back to you if I find a solution for LXPLUS which is CMS agnostic and does not require additional installs.

Cheers,
Danilo

Hi Danilo,

thanks for your response. I think I agree that it’s a configuration issue rather than something more fundamental, however, regarding your comment 2) I tried it in a CMSSW_8_0_0_pre2 release and get the same issue.

So if I get my environment from CMSSW 8, I get ipython version 3.1.0, which is already much better than the 0.13.2 which is the default on lxplus.

Then I run these three commands:

source /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.04.02-a6f71/x86_64-slc6-gcc49-dbg/bin/thisroot.sh source /cvmfs/sft.cern.ch/lcg/releases/gcc/4.9.3/x86_64-slc6/setup.sh export PATH=/cvmfs/sft.cern.ch/lcg/releases/Python/2.7.9.p1-df007/x86_64-slc6-gcc49-opt/bin/:$PATH

which then load the right python version 2.7.9. However, if I then import ROOT I get some warnings from TInterpreter::ReadRootmapFile that some classes are already in libCore.so. But ok, ignoring those errors and running

seems to be working at first, i.e. it finds TMVAGui etc, then it flashes a GUI window open, but closes it immediately, not to be recovered.

Running it in a python prompt does the same, it does not keep the window open.

I’m a bit at loss, really.
Any idea would be appreciated.
-m

Hi Marc,

I’ll leave the issues of the CMS environment to CMS if you agree: I am sure that you’ll find all the support with the experts within the experiment.
Now, for what concerns the general solution on lxplus, this works:

source /afs/cern.ch/sw/lcg/releases/LCG_82/pytools/1.9_python2.7/x86_64-slc6-gcc49-opt/pytools-env.sh 
source /afs/cern.ch/sw/lcg/releases/gcc/4.9.3/x86_64-slc6/setup.sh
/afs/cern.ch/sw/lcg/releases/ROOT/6.04.12-c016e/x86_64-slc6-gcc49-opt/bin/thisroot.sh
ipython
Python 2.7.10 (default, Nov 27 2015, 20:46:47) 
Type "copyright", "credits" or "license" for more information.

IPython 3.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import ROOT
In [2]: ROOT.TMVA.TMVAGui('TMVAoutput.root')
TUnixSystem::SetDisplay:0: RuntimeWarning: DISPLAY not set, setting it to pb-d-128-141-235-224.cern.ch:0.0
--- Launch TMVA GUI to view input file: TMVAoutput.root
Error in <TFile::TFile>: file TMVAoutput.root does not exist
==> Abort TMVAGui, please verify filename

Danilo