To solve AttributeError: module ‘tensorflow._api.v1.compat.v2’ has no attribute ‘__internal__ error follow below methods.
ERROR LOG
Using TensorFlow backend.
Traceback (most recent call last):
File "train.py", line 6, in <module>
File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/util/module_wrapper.py", line 193, in __getattr__
attr = getattr(self._tfmw_wrapped_module, name)
AttributeError: module 'tensorflow._api.v1.compat.v2' has no attribute '__internal__'
Contents
How to solve AttributeError: module ‘tensorflow._api.v1.compat.v2’ has no attribute ‘__internal__ ?
To solve AttributeError: module ‘tensorflow._api.v1.compat.v2’ has no attribute ‘__internal__ error follow the below commands and run them.
!pip3 uninstall keras-nightly
!pip3 uninstall -y tensorflow
!pip3 install keras==2.1.6
!pip3 install tensorflow==1.15.0
!pip3 install h5py==2.10.0
Alternative to Solve AttributeError: module ‘tensorflow._api.v1.compat.v2’ has no attribute ‘__internal__
To Resolve AttributeError: The module ‘tensorflow. api.v1.compat.v2’ does not have the attribute ‘internal’. Google colab error while running this code to degrade your Tensorflow! pip Tensorflow==1.13.0 must be installed. Everything else remains the same. I updated it with: % tensorflow version 1.x. It was successful.
running this code to downgrade my tensorflow
!pip install tensorflow==1.13.0
I replaced it with:
%tensorflow_version 1.x
Hope the above solution works.
Also read :
ModuleNotFoundError: No module named ‘imblearn’
UserWarning: Workbook contains no default style apply openpyxl’s default