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

AttributeError: module 'tensorflow' has no attribute 'get_default_graph' #26

Open
Bababalei opened this issue Apr 13, 2020 · 7 comments

Comments

@Bababalei
Copy link

image

@Bababalei
Copy link
Author

When I run the Google Colab file, I happened this issue and even though I re-install tensorflow 2.0.0 or manually change from keras import to from tensorflow.keras import, this error still existed

@alireza116
Copy link

Change the tenslrflow version to the version mentioned in the github. 1.2 something. And it will work.

@JanKesek
Copy link

Change the tenslrflow version to the version mentioned in the github. 1.2 something. And it will work.

so i reseted runtime and then changed tensorflow version with

%tensorflow_version 1.12.0

but then i get another error while running model constructor:

AttributeError Traceback (most recent call last)

in ()
----> 1 model = FaceTranslationGANInferenceModel()

7 frames

/tensorflow-1.15.2/python3.6/tensorflow_core/python/util/module_wrapper.py in getattr(self, name)
191 def getattr(self, name):
192 try:
--> 193 attr = getattr(self._tfmw_wrapped_module, name)
194 except AttributeError:
195 if not self._tfmw_public_apis:

AttributeError: module 'tensorflow' has no attribute 'ops'

@amrzv
Copy link

amrzv commented Jan 7, 2021

so i reseted runtime and then changed tensorflow version with

%tensorflow_version 1.12.0

This does not change tf version to 1.12.0. This magic only change between latest 1.x and 2.x versions. You should manually install 1.12.0 or 1.13.1.
P.S: I use !pip install keras==2.2.4 tensorflow==1.13.1 and notebook works well

@ibtehajali67
Copy link

I solved this issue by using these command
pip uninstall -y tensorflow
pip install tensorflow-gpu==1.13.1

@molo32
Copy link

molo32 commented Jun 13, 2021

still gives this error

from models import FaceTranslationGANInferenceModel

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-12-e0f766e65a9c> in <module>()
----> 1 from models import FaceTranslationGANInferenceModel

5 frames
/tensorflow-1.15.2/python3.7/keras/backend/load_backend.py in <module>()
     13 from .common import set_image_data_format
     14 from .common import normalize_data_format
---> 15 from .common import symbolic, eager
     16 
     17 # Set Keras base dir path given KERAS_HOME env variable, if applicable.

ImportError: cannot import name 'symbolic' from 'keras.backend.common' (/usr/local/lib/python3.7/dist-packages/keras/backend/common.py)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

@amrzv
Copy link

amrzv commented Jul 4, 2021

See this comment #32 (comment)

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

6 participants