ImportError: cannot import name ‘get_config’ from ‘tensorflow.python.eager.context’

We Are Going To Discuss About ImportError: cannot import name ‘get_config’ from ‘tensorflow.python.eager.context’. So lets Start this Python Article.

ImportError: cannot import name ‘get_config’ from ‘tensorflow.python.eager.context’

  1. How to solve ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context'

    Instead of:
    import keras
    Try:
    from tensorflow import keras

  2. ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context'

    Instead of:
    import keras
    Try:
    from tensorflow import keras

Solution 1

Instead of:

import keras

Try:

from tensorflow import keras 

Original Author Anusha Of This Content

Solution 2

These commands fixed the issue:

pip install --upgrade tensorflow
pip install --upgrade tensorflow-gpu

Original Author thomle295 Of This Content

Solution 3

Try the version of Keras 2.3.1

pip install keras==2.3.1

then also install that

pip install git+https://www.github.com/keras-team/keras-contrib.git

Original Author MD Gazuruddin Of This Content

Solution 4

instead of
from keras.preprocessing import image
do this:
from tensorflow.keras.preprocessing import image

Original Author bart-khalid Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment