# TMVAGui in ipython

**URL:** <https://root-forum.cern.ch/t/tmvagui-in-ipython/20312>\
**Category:** TMVA\
**Created:** [December 9, 2015, 4:00pm UTC](https://root-forum.cern.ch/t/tmvagui-in-ipython/20312 "2015-12-09T16:00:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdunser](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdunser/32/20817_2.png) [@mdunser](https://root-forum.cern.ch/u/mdunser)\
**Post date:** [December 9, 2015, 4:00pm UTC](https://root-forum.cern.ch/t/tmvagui-in-ipython/20312/1 "2015-12-09T16:00:54Z")

</div>

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](http://comments.gmane.org/gmane.comp.lang.c%2B%2B.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:

```auto

```

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

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [December 9, 2015, 5:10pm UTC](https://root-forum.cern.ch/t/tmvagui-in-ipython/20312/2 "2015-12-09T17:10:08Z")

</div>

Hi Marc,

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

```auto
 . /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

---

<div class="post-metadata">

**Author:** ![mdunser](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdunser/32/20817_2.png) [@mdunser](https://root-forum.cern.ch/u/mdunser)\
**Post date:** [December 9, 2015, 5:41pm UTC](https://root-forum.cern.ch/t/tmvagui-in-ipython/20312/3 "2015-12-09T17:41:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [December 10, 2015, 6:54am UTC](https://root-forum.cern.ch/t/tmvagui-in-ipython/20312/4 "2015-12-10T06:54:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mdunser](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdunser/32/20817_2.png) [@mdunser](https://root-forum.cern.ch/u/mdunser)\
**Post date:** [December 10, 2015, 11:03am UTC](https://root-forum.cern.ch/t/tmvagui-in-ipython/20312/5 "2015-12-10T11:03:28Z")

</div>

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](http://libCore.so). But ok, ignoring those errors and running

```auto

```

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

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [December 10, 2015, 11:09am UTC](https://root-forum.cern.ch/t/tmvagui-in-ipython/20312/6 "2015-12-10T11:09:22Z")

</div>

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:

```auto
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
