# 'TMVA' has no attribute 'PyMethodBase'

**URL:** <https://root-forum.cern.ch/t/tmva-has-no-attribute-pymethodbase/25105>\
**Category:** TMVA\
**Tags:** python\
**Created:** [June 13, 2017, 10:09am UTC](https://root-forum.cern.ch/t/tmva-has-no-attribute-pymethodbase/25105 "2017-06-13T10:09:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vidya\_Sagar\_V](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/74df32/32.png) [@Vidya\_Sagar\_V](https://root-forum.cern.ch/u/Vidya_Sagar_V)\
**Post date:** [June 13, 2017, 10:09am UTC](https://root-forum.cern.ch/t/tmva-has-no-attribute-pymethodbase/25105/1 "2017-06-13T10:09:22Z")

</div>

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

```auto
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](https://root-forum.cern.ch/uploads/default/original/2X/6/6dafbc78212c6d7f3874dd73eebc7bf379ec6e4f.py) (2.1 KB)

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [June 13, 2017, 3:19pm UTC](https://root-forum.cern.ch/t/tmva-has-no-attribute-pymethodbase/25105/2 "2017-06-13T15:19:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lgolino](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/9f8e36/32.png) [@lgolino](https://root-forum.cern.ch/u/lgolino)\
**Post date:** [June 2, 2023, 8:57pm UTC](https://root-forum.cern.ch/t/tmva-has-no-attribute-pymethodbase/25105/3 "2023-06-02T20:57:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lgolino](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/9f8e36/32.png) [@lgolino](https://root-forum.cern.ch/u/lgolino)\
**Post date:** [June 2, 2023, 9:04pm UTC](https://root-forum.cern.ch/t/tmva-has-no-attribute-pymethodbase/25105/4 "2023-06-02T21:04:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lgolino](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/9f8e36/32.png) [@lgolino](https://root-forum.cern.ch/u/lgolino)\
**Post date:** [June 2, 2023, 9:18pm UTC](https://root-forum.cern.ch/t/tmva-has-no-attribute-pymethodbase/25105/5 "2023-06-02T21:18:07Z")

</div>

Sorry for spam:

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

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

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [June 3, 2023, 8:12am UTC](https://root-forum.cern.ch/t/tmva-has-no-attribute-pymethodbase/25105/6 "2023-06-03T08:12:13Z")

</div>

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

```
