# Problems with TMVA while running python

**URL:** <https://root-forum.cern.ch/t/problems-with-tmva-while-running-python/46837>\
**Category:** TMVA\
**Created:** [September 14, 2021, 6:31pm UTC](https://root-forum.cern.ch/t/problems-with-tmva-while-running-python/46837 "2021-09-14T18:31:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![11133](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/11133/32/25084_2.png) [@11133](https://root-forum.cern.ch/u/11133)\
**Post date:** [September 14, 2021, 6:31pm UTC](https://root-forum.cern.ch/t/problems-with-tmva-while-running-python/46837/1 "2021-09-14T18:31:52Z")

</div>

Dear TMVA experts,

I installed the latest version of the ROOT and python. I need to run the python project with Keras API. However, the following crash had happened while I tried to run my python script:

File “keras0\_Binary.py”, line 22, in   
TMVA.PyMethodBase.PyInitialize()  
AttributeError: \<namespace cppyy.gbl.TMVA at 0x7ff6c1e6d630\> has no attribute ‘PyMethodBase’. Full details:  
type object ‘TMVA’ has no attribute ‘PyMethodBase’  
‘TMVA::PyMethodBase’ is not a known C++ class  
‘PyMethodBase’ is not a known C++ template  
‘PyMethodBase’ is not a known C++ enum

I’ve installed all the packages like NumPy, SciPy, etc., and build the ROOT with a flag pointing to the python executables.

I’m a beginner in the field of ML application in HEP, any tips and help would be highly appreciated.

Cheers, Aizat

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [September 15, 2021, 6:39am UTC](https://root-forum.cern.ch/t/problems-with-tmva-while-running-python/46837/2 "2021-09-15T06:39:48Z")

</div>

Welcome to the ROOT Forum! Maybe @moneta can help you

---

<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:** [September 28, 2021, 3:31pm UTC](https://root-forum.cern.ch/t/problems-with-tmva-while-running-python/46837/3 "2021-09-28T15:31:36Z")

</div>

Hi,

Sorry for the late reply. It looks like you have built ROOT without support for pymva. Can you try configuring with `cmake . -Dtmva-pymva=On` and check in the log if all Python and bumpy packages are correctly found.

Lorenzo

---

<div class="post-metadata">

**Author:** ![11133](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/11133/32/25084_2.png) [@11133](https://root-forum.cern.ch/u/11133)\
**Post date:** [October 6, 2021, 8:43am UTC](https://root-forum.cern.ch/t/problems-with-tmva-while-running-python/46837/4 "2021-10-06T08:43:11Z")

</div>

Hi,

I’ve tried cmake . -Dtmva-pymva=On and got the following message in the log:

TMVA: Numpy or Python development package not found for python /usr/bin/python3. Switching off tmva-pymva option

I’m confused since I installed these packages even using conda to allow system to find all the required packages easily. (If I’m correct at that point).

Any suggestions? Thank you!

Cheers,  
Aizat

---

<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:** [October 6, 2021, 8:50am UTC](https://root-forum.cern.ch/t/problems-with-tmva-while-running-python/46837/5 "2021-10-06T08:50:06Z")

</div>

Ubuntu 18, 20: `sudo apt-get install python3-numpy python3-dev`  
CentOS 7 (needs enabled “epel” repository): `sudo yum install python3-numpy python3-devel`
