'Tensorflow AttributeError: module tensorflow has no attribute v1

A Python Tensorflow Keras app runs Azure VM Windows Server 2019 Datacenter. I copied the requirements.txt file and install on a 2nd VM.

On the statement "import keras", Exception Attribute: "tensorflow.api.v1.compat.v2.compat" has no attribute "v1".

I've removed and reinstalled Tensorflow and Keras keeping the same version.

Python 3.7.6

tensorboard==1.14.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.0
tensorflow==1.14.0
tensorflow-estimator==1.14.0

Keras==2.3.1
Keras-Applications==1.0.8
keras-nightly==2.5.0.dev2021032900
Keras-Preprocessing==1.1.2

Help is appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source