Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mansi-aggarwal-2504 opened this issue Jul 19, 2021 · 4 comments

Comments

@mansi-aggarwal-2504
Copy link

I keep getting different error relating to Keras and Tensorflow most likely due to version compatibility issues.
Since I was getting this error: TypeError: Could not build a TypeSpec for <KerasTensor: shape=(None, None, 4) I downgraded tf to 2.3.0.
Now I keep getting this error:

Traceback (most recent call last):
  File "flower.py", line 43, in <module>
    from mrcnn import model as modellib, utils
  File "/content/gdrive/My Drive/Mask_RCNN_GrapeDetection/Mask_RCNN/mrcnn/model.py", line 26, in <module>
    import keras.engine.topology as KE
  File "/usr/local/lib/python3.7/dist-packages/keras/__init__.py", line 25, in <module>
    from keras import models
  File "/usr/local/lib/python3.7/dist-packages/keras/models.py", line 19, in <module>
    from keras import backend
  File "/usr/local/lib/python3.7/dist-packages/keras/backend.py", line 37, in <module>
    from tensorflow.python.eager.context import get_config
ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context' (/usr/local/lib/python3.7/dist-packages/tensorflow/python/eager/context.py)

I tried modifying model.py, mainly the way I import keras and its modules; changed import keras to from tensorflow import keras but I keep getting some kind of an error.

If someone could mention a pip freeze > out.txt with versions and dependencies that are needed for proper training, that'd be great!

@nataliameira
Copy link

@mansi-aggarwal-2504
Hey
I trained my model and visualized the data.
My training was held on June 3, 2021.
I used:

pip uninstall keras-nightly
pip uninstall -y tensorflow
h5py==2.10.0
tensorflow==1.15
tensorflow-gpu==1.15.0
keras==2.1.6

@mansi-aggarwal-2504
Copy link
Author

Thank you @nataliameira! This helped.

@Sultan91
Copy link

Sultan91 commented Oct 2, 2021

It says Could not find a version that satisfies the requirement tensorflow==1.15

@nataliameira
Copy link

nataliameira commented Oct 2, 2021

It says Could not find a version that satisfies the requirement tensorflow==1.15

@Sultan91 Use python version 3.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants