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 'keras.backend' has no attribute 'get_graph' #97

Open
bahrami4444 opened this issue Sep 2, 2023 · 6 comments
Open

Comments

@bahrami4444
Copy link

Hi. I encounter this error when importing SciANN:

AttributeError: module 'keras.backend' has no attribute 'get_graph'

I have installed the latest version of keras and Tensorflow. Can anyone help me?

Here is the full text of the error:


AttributeError Traceback (most recent call last)
Cell In[2], line 2
1 import numpy as np
----> 2 import sciann as sn
3 from sciann.utils.math import abs, diff
4 from itertools import cycle

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sciann_init_.py:10
7 tf.get_logger().setLevel('ERROR')
8 tf.compat.v1.disable_eager_execution()
---> 10 from . import constraints
11 from . import functionals
12 from . import models

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sciann\constraints_init_.py:7
3 from future import division
4 from future import print_function
----> 7 from . import constraint
8 from . import data
9 from . import pde

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sciann\constraints\constraint.py:8
5 from future import division
6 from future import print_function
----> 8 from ..utils import is_tensor
11 class Constraint(object):
12 """ Configures the condition to impose constraint.
13
14 # Arguments
(...)
23 ValueError for unrecognized inputs.
24 """

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sciann\utils_init_.py:7
3 from future import division
4 from future import print_function
----> 7 from . import math
8 from . import utilities
9 from . import validations

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\sciann\utils\math.py:10
8 import tensorflow as tf
9 from keras import backend as K
---> 10 graph_unique_name = K.get_graph().unique_name
12 from keras.layers import Layer, Lambda, Flatten, Dense
13 from keras.layers import Dot

AttributeError: module 'keras.backend' has no attribute 'get_graph

@TranTienDat-SU
Copy link

I also got the same error.

@nargesmalekjani
Copy link

hi, I got the same error

@ziqiang-shi
Copy link

I also got the same error. Did you solve it?

@ehsanhaghighat
Copy link
Owner

ehsanhaghighat commented Nov 6, 2023 via email

@tirtho109
Copy link

tirtho109 commented Nov 9, 2023

Hi,

I had the same issue. For my project environment I used

python==3.7 numpy==1.21.6 sciann==0.7.0.1 matplotlib==3.5.3 scipy==1.7.3 pandas==1.3.5 plotly==5.18.0 tensorflow==2.11.0

And, It worked perfectly.

@pdpino
Copy link

pdpino commented Nov 20, 2023

I had the same issue in Google Colab that currently has TF 2.14 by default. I installed TF 2.11 and it worked.

I had to uninstall tensorflow-datasets and tensorflow-metadata that had conflicting versions with tensorflow==2.11. Overall I did:

pip uninstall tensorflow-datasets tensorflow-metadata -y
pip install tensorflow==2.11
pip install sciann

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

7 participants