Module object has no attribute when running jupyter notebook on macbook

Im running a jupyter notebook ive ran before but im getting this error of a module object:

Using TensorFlow backend.

AttributeErrorTraceback (most recent call last)
in ()
5 from import rmse
6 from sklearn.preprocessing import MinMaxScaler
----> 7 from keras.preprocessing.sequence import TimeseriesGenerator
8 from keras.models import Sequential
9 from keras.layers import Dense

/opt/anaconda2/lib/python2.7/site-packages/keras/ in ()
1 from future import absolute_import
----> 3 from . import utils
4 from . import activations
5 from . import applications

/opt/anaconda2/lib/python2.7/site-packages/keras/utils/ in ()
25 from .np_utils import to_categorical
26 from .np_utils import normalize
—> 27 from .multi_gpu_utils import multi_gpu_model

/opt/anaconda2/lib/python2.7/site-packages/keras/utils/ in ()
5 from future import print_function
----> 7 from …layers.merge import concatenate
8 from … import backend as K
9 from …layers.core import Lambda

/opt/anaconda2/lib/python2.7/site-packages/keras/layers/ in ()
3 from …utils.generic_utils import deserialize_keras_object
----> 4 from …engine.base_layer import Layer
5 from …engine import Input
6 from …engine import InputLayer

/opt/anaconda2/lib/python2.7/site-packages/keras/engine/ in ()
6 from .base_layer import Layer
7 from .network import get_source_inputs
----> 8 from .training import Model

/opt/anaconda2/lib/python2.7/site-packages/keras/engine/ in ()
19 from .training_utils import standardize_weights
20 from .training_utils import weighted_masked_objective
—> 21 from . import training_arrays
22 from . import training_generator
23 from … import backend as K

/opt/anaconda2/lib/python2.7/site-packages/keras/engine/ in ()
12 from .training_utils import check_num_samples
13 from … import backend as K
—> 14 from … import callbacks as cbks
15 from …utils.generic_utils import Progbar
16 from …utils.generic_utils import slice_arrays

/opt/anaconda2/lib/python2.7/site-packages/keras/callbacks/ in ()
17 from … import backend as K
—> 19 if K.backend() == ‘tensorflow’ and not K.tensorflow_backend._is_tf_1():
20 from .tensorboard_v2 import TensorBoard
21 else:

AttributeError: ‘module’ object has no attribute ‘_is_tf_1’

1 Like

dear quique123

long time no see.

Do you know how Python error display works?

It is basically displayed by “Traceback”.

If you go up the call history of the displayed error code, you will reach your own code that causes the exception. Tracking this call history retroactively is called “Traceback”.

In other words, it is an error display because you are calling an attribute that does not exist in the writing of some code.

We encourage you to read the Tesorflow and Keras manuals and fix the code.



regards, you.

The most likely causes:

  • you have ended up with an environment where package versions are incompatible. Trye installing a new environment with a single .yaml env spec file
  • you have some files in your local directory with the same name as packages you are trying to import. Python will usually prefer the local directory for imports, so you can grab something that is unexpected.
1 Like


nice to meet you.
thank you for the advice.
The phenomenon you wrote is a phenomenon that beginners and veteran AI programmers are likely to encounter.

This is especially likely to occur in situations where multiple imported site packages are included multiple times.

In such cases, we recommend organizing the packages, but I think that’s exactly the case.

see you.