'tensorflow, keras and circular import error

I'm trying my hand at replicating what this dude did on his github and trying to run some of his scripts (stock price prediction allegedly). I keep bumping into this error no matter what I do. I have a feeling I didn't set up tensorflow or keras properly.

File "/home/mihai/.local/lib/python3.8/site-packages/keras/api/_v2/keras/utils/__init__.py", line 38, in <module>
    from keras.utils.vis_utils import plot_model
ImportError: cannot import name 'plot_model' from partially initialized module 'keras.utils.vis_utils' (most likely due to a circular import) (/home/mihai/.local/lib/python3.8/site-packages/keras/utils/vis_utils.py)

Would appreciate any input!



Solution 1:[1]

you can look here -> This worked taking from TensorFlow documentation

try is also

from keras.utils.vis_utils import plot_model

or

from tensorflow.keras.utils import plot_model

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 tomerar