# New version of Keras and conflict with TMVA!

**URL:** <https://root-forum.cern.ch/t/new-version-of-keras-and-conflict-with-tmva/40589>\
**Category:** TMVA\
**Created:** [July 23, 2020, 5:10pm UTC](https://root-forum.cern.ch/t/new-version-of-keras-and-conflict-with-tmva/40589 "2020-07-23T17:10:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cxwx1](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/cxwx1/32/22433_2.png) [@cxwx1](https://root-forum.cern.ch/u/cxwx1)\
**Post date:** [July 23, 2020, 5:10pm UTC](https://root-forum.cern.ch/t/new-version-of-keras-and-conflict-with-tmva/40589/1 "2020-07-23T17:10:19Z")

</div>

tensorflow 2.2.0  
Keras 2.4.3 [2.3.0 OK]

running tutorial  
`tutorials/tmva/keras/RegressionKeras.py`  
bugs

```auto
ImportError: cannot import name 'tensorflow_backend' from 'keras.backend' (/usr/local/lib/python3.8/site-packages/keras/backend.py)

```

and I thinks the TMVA method PyKeras should have a function check Keras and tensor flow version so that it would not run if version is not right

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [July 24, 2020, 7:33am UTC](https://root-forum.cern.ch/t/new-version-of-keras-and-conflict-with-tmva/40589/2 "2020-07-24T07:33:36Z")

</div>

Hi,  
can you use keras+tensorflow at all (i.e. without tmva involved)?  
As far as I can tell this is a problem with keras+tensorflow. I don’t think it’s too unreasonable if ROOT assumes the environment is sane if keras is found.

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![cxwx1](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/cxwx1/32/22433_2.png) [@cxwx1](https://root-forum.cern.ch/u/cxwx1)\
**Post date:** [July 24, 2020, 8:50am UTC](https://root-forum.cern.ch/t/new-version-of-keras-and-conflict-with-tmva/40589/3 "2020-07-24T08:50:47Z")

</div>

of course yes, just a potential bug report for future use

---

<div class="post-metadata">

**Author:** ![DaniloSerna](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/daniloserna/32/34283_2.png) [@DaniloSerna](https://root-forum.cern.ch/u/DaniloSerna)\
**Post date:** [September 6, 2023, 4:05am UTC](https://root-forum.cern.ch/t/new-version-of-keras-and-conflict-with-tmva/40589/4 "2023-09-06T04:05:58Z")

</div>

I have the same issue, but I am working inside the CMSSW environment:  
(Keras == 2.4.3, Tensorflow == 2.5.0 )

Traceback (most recent call last):  
File “”, line 1, in   
ImportError: cannot import name ‘tensorflow\_backend’ from ‘keras.backend’ (/cvmfs/cms.cern.ch/slc7\_amd64\_gcc10/external/py3-Keras/2.4.3-llifpc2/lib/python3.9/site-packages/keras/backend.py)  
 :  
\*\*\*\> abort program execution

Does someone know how I can I change the Keras and Tensorflow version inside the cmsenv?  
Thanks in advance!
