'Tensorflow.compat not found

I am trying

import tensorflow.compat.v1 as tf 

and getting an error

ModuleNotFoundError: No module named 'tensorflow.compat'. 

I've installed tensorflow=2.8.0, tensorflow-estimator=2.1, tensorflow-gpu=2.8.0 and the python version is 3.9.9. What could be the issue?



Sources

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

Source: Stack Overflow

Solution Source