from keras.utils import to_categorical
module 'tensorflow.compat.v2' has no attribute '__internal__
from keras.utils import to_categorical
$ python testerr.py
Using TensorFlow backend.
Traceback (most recent call last):
File "testerr.py", line 5, in <module>
from keras.utils import to_categorical
File "/home/sqxiong/anaconda3/envs/tens/lib/python3.6/site-packages/keras/__init__.py", line 3, in <module>
from . import utils
File "/home/sqxiong/anaconda3/envs/tens/lib/python3.6/site-packages/keras/utils/__init__.py", line 26, in <module>
from .vis_utils import model_to_dot
File "/home/sqxiong/anaconda3/envs/tens/lib/python3.6/site-packages/keras/utils/vis_utils.py", line 7, in <module>
from ..models import Model
File "/home/sqxiong/anaconda3/envs/tens/lib/python3.6/site-packages/keras/models.py", line 10, in <module>
from .engine.input_layer import Input
File "/home/sqxiong/anaconda3/envs/tens/lib/python3.6/site-packages/keras/engine/__init__.py", line 3, in <module>
from .input_layer import Input
File "/home/sqxiong/anaconda3/envs/tens/lib/python3.6/site-packages/keras/engine/input_layer.py", line 7, in <module>
from .base_layer import Layer
File "/home/sqxiong/anaconda3/envs/tens/lib/python3.6/site-packages/keras/engine/base_layer.py", line 12, in <module>
from .. import initializers
File "/home/sqxiong/anaconda3/envs/tens/lib/python3.6/site-packages/keras/initializers/__init__.py", line 124, in <module>
populate_deserializable_objects()
File "/home/sqxiong/anaconda3/envs/tens/lib/python3.6/site-packages/keras/initializers/__init__.py", line 49, in populate_deserializable_objects
LOCAL.GENERATED_WITH_V2 = tf.__internal__.tf2.enabled()
AttributeError: module 'tensorflow.compat.v2' has no attribute '__internal__'
(tens) [sqxiong@ibiomed plek_attention]$ python testerr.py ^C
(tens) [sqxiong@ibiomed plek_attention]$ vim testerr.py