'TMVA' has no attribute 'PyMethodBase'

When I try running ClassificaionKeras.py given in root 6.08 tutorials/ folder (also attached) I get the following output:

Traceback (most recent call last):
  File "ClassificationKeras.py", line 15, in <module>
    TMVA.PyMethodBase.PyInitialize()
AttributeError: type object 'TMVA' has no attribute 'PyMethodBase'

Can anyone help me?

ClassificationKeras.py (2.1 KB)

Hi,
I guess your ROOT installation has not been enabled with PyMVA. This can happen if you don’t have Numpy installed in your system. You should installed Numpy and then rebuild ROOT

Cheers

Lorenzo

Hi, the same has happened to me even though I have numpy installed and did when I built root. Any suggestions?

Actually I see the issue, python3 has numpy but not python2. I am struggling to find a way to pip install on python2…

Sorry for spam:

so both pip and pip3 were pointing at python3 i had to run:

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py

then pip2 install numpy to ensure python2 had numpy. Rebuilding root now, will let you know…

okay still doesn’t work. Did I need to enable something in root ccmake?

root-config --has-pyroot # python support ;
root-config --python-version # C/C++ calling python ;
root-config --python2-version # python 2 calling C/C++ ;
root-config --python3-version # python 3 calling C/C++ ;
root-config --has-tmva # TMVA support ;
root-config --has-tmva-pymva # python TMVA support ;