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

tensorflow issue? #1

Open
tdmseismo opened this issue Oct 30, 2023 · 5 comments
Open

tensorflow issue? #1

tdmseismo opened this issue Oct 30, 2023 · 5 comments

Comments

@tdmseismo
Copy link

I successfully installed the package but I get an error when I try to run the first tutorial file: "01_True_positive_and_false_negative_examples_of_the_EqT_model.py".

I would appreciate it if you could help me to solve this problem. I have already tried to reinstall tensorflow and keras but the issue still persists.

The error is as below:

Using TensorFlow backend.


TypeError Traceback (most recent call last)
in
12 import numpy as np
13 import matplotlib.pyplot as plt
---> 14 from keras.models import load_model, Model
15 from EqT_libs.EqT_utils import DataGeneratorPrediction, picker, generate_arrays_from_file
16 from EqT_libs.EqT_utils import f1, SeqSelfAttention, FeedForward, LayerNormalization

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/keras/init.py in
1 from future import absolute_import
2
----> 3 from . import utils
4 from . import activations
5 from . import applications

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/keras/utils/init.py in
4 from . import data_utils
5 from . import io_utils
----> 6 from . import conv_utils
7 from . import losses_utils
8 from . import metrics_utils

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/keras/utils/conv_utils.py in
7 from six.moves import range
8 import numpy as np
----> 9 from .. import backend as K
10
11

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/keras/backend/init.py in
----> 1 from .load_backend import epsilon
2 from .load_backend import set_epsilon
3 from .load_backend import floatx
4 from .load_backend import set_floatx
5 from .load_backend import cast_to_floatx

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/keras/backend/load_backend.py in
88 elif _BACKEND == 'tensorflow':
89 sys.stderr.write('Using TensorFlow backend.\n')
---> 90 from .tensorflow_backend import *
91 else:
92 # Try and load external backend.

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in
3 from future import print_function
4
----> 5 import tensorflow as tf
6 from tensorflow.python.eager import context
7 from tensorflow.python.framework import device as tfdev

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/tensorflow/init.py in
26
27 # pylint: disable=g-bad-import-order
---> 28 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
29 from tensorflow.python.tools import module_util as _module_util
30

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/tensorflow/python/init.py in
61
62 # Framework
---> 63 from tensorflow.python.framework.framework_lib import * # pylint: disable=redefined-builtin
64 from tensorflow.python.framework.versions import *
65 from tensorflow.python.framework import config

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/tensorflow/python/framework/framework_lib.py in
23 # Classes used when building a Graph.
24 from tensorflow.python.framework.device import DeviceSpec
---> 25 from tensorflow.python.framework.ops import Graph
26 from tensorflow.python.framework.ops import Operation
27 from tensorflow.python.framework.ops import Tensor
~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/tensorflow/python/framework/ops.py in
52 from tensorflow.python.framework import versions
53 from tensorflow.python.ops import control_flow_util
---> 54 from tensorflow.python.platform import app
55 from tensorflow.python.platform import tf_logging as logging
56 from tensorflow.python.util import compat

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/tensorflow/python/platform/app.py in
21 import sys as _sys
22
---> 23 from absl.app import run as _run
24
25 from tensorflow.python.platform import flags

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/absl/app.py in
35
36 from absl import command_name
---> 37 from absl import flags
38 from absl import logging
39

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/absl/flags/init.py in
33 import warnings
34
---> 35 from absl.flags import _argument_parser
36 from absl.flags import _defines
37 from absl.flags import _exceptions

~/Programs/miniconda3/envs/seqt/lib/python3.6/site-packages/absl/flags/_argument_parser.py in
80
81
---> 82 class ArgumentParser(Generic[_T], metaclass=_ArgumentParserCache):
83 """Base class used to parse and convert arguments.
84

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

@MrXiaoXiao
Copy link
Owner

It seems that the problem is caused by incorrect installation of tensorflow and keras. What verions of tensorflow and keras are you using?

@tdmseismo
Copy link
Author

I have followed the installation guide provided in the site. Here is the list of installed packages:
$ conda list | grep "tensorflow"
tensorflow 1.14.0 hc3e5e64_0 conda-forge
tensorflow-base 1.14.0 py36hc3e5e64_0 conda-forge
tensorflow-estimator 1.14.0 py36h5ca1d4c_0 conda-forge
tensorflow-gpu 1.14.0 h0d30ee6_0

$ conda list | grep "keras"
keras-applications 1.0.8 py_1 conda-forge
keras-base 2.3.1 py36_0
keras-gpu 2.3.1 0
keras-preprocessing 1.1.2 pyhd8ed1ab_0 conda-forge
keras-rectified-adam 0.20.0 pypi_0 pypi

@tdmseismo tdmseismo closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2023
@tdmseismo tdmseismo reopened this Oct 31, 2023
@MrXiaoXiao
Copy link
Owner

You can try to install tensorflow and keras through anaconda channel (conda install -c anaconda tensorflow=1.14 keras=2.3.1). This might solve your problem.

@tdmseismo
Copy link
Author

Thanks for the suggestion but the issue still persists!

@heloproc
Copy link

heloproc commented Nov 6, 2023

It seems like there is a conflict with the metaclass in your code. The metaclass of a derived class must be a subclass of the metaclasses of all its bases. Double-check the inheritance hierarchy of your classes to ensure that the metaclasses are compatible.
Or is there some conflicting metaclasses used in your code? Just check it

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