Riley Fitzpatrick
Riley Fitzpatrick

Reputation: 929

AttributeError: module 'tensorboard' has no attribute 'lazy'

I have a generative adversarial network using Keras with a tensorflow backend. I am running Tensorflow 1.14.0, Python 3.7.4, and Keras 2.2.4. The full error is:

Using TensorFlow backend.
Traceback (most recent call last):
  File "C:/Users/Riley/PycharmProjects/shoeGAN/shoeWGAN.py", line 7, in <module>
    from keras.layers import *
  File "C:\Users\Riley\AppData\Local\Programs\Python\Python35\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import utils
  File "C:\Users\Riley\AppData\Local\Programs\Python\Python35\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
    from . import conv_utils
  File "C:\Users\Riley\AppData\Local\Programs\Python\Python35\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
    from .. import backend as K
  File "C:\Users\Riley\AppData\Local\Programs\Python\Python35\lib\site-packages\keras\backend\__init__.py", line 89, in <module>
    from .tensorflow_backend import *
  File "C:\Users\Riley\AppData\Local\Programs\Python\Python35\lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
    import tensorflow as tf
  File "C:\Users\Riley\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line 35, in <module>
    from tensorflow._api.v1 import compat
  File "C:\Users\Riley\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\_api\v1\compat\__init__.py", line 22, in <module>
    from tensorflow._api.v1.compat import v2
  File "C:\Users\Riley\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\_api\v1\compat\v2\__init__.py", line 303, in <module>
    from tensorboard.summary._tf import summary
  File "C:\Users\Riley\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorboard\summary\__init__.py", line 32, in <module>
    from tensorboard.summary import v2
  File "C:\Users\Riley\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorboard\summary\v2.py", line 24, in <module>
    from tensorboard.plugins.audio.summary_v2 import audio
  File "C:\Users\Riley\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorboard\plugins\audio\summary_v2.py", line 30, in <module>
    from tensorboard.compat import tf2 as tf
  File "C:\Users\Riley\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorboard\compat\__init__.py", line 28, in <module>
    import tensorboard.lazy as _lazy
AttributeError: module 'tensorboard' has no attribute 'lazy'

I didn't include the full code, because the error comes up during imports, which are below:

import os

import matplotlib.pyplot as plt

import numpy as np

from keras.layers import *
from keras.models import *
from keras.optimizers import *
from keras.initializers import *
from keras.callbacks import *
from keras.utils.generic_utils import Progbar
from keras.preprocessing.image import save_img

Things I have tried:

Any ideas? Thanks!

Upvotes: 5

Views: 10398

Answers (3)

ruwanmadhusanka
ruwanmadhusanka

Reputation: 989

You should uninstall tensorflow-tensorboard using following command.

pip uninstall tensorflow-tensorboard

Upvotes: 0

diman82
diman82

Reputation: 738

tensorflow-tensorboard has been deprecated, so you should uninstall it and use the latest version of tensorboard (2.4.0 at the moment of writing this reply).

pip install tensorboard

Upvotes: 0

89f3a1c
89f3a1c

Reputation: 1488

Here is the issue stating your error on Github.

At first, someone noted that only the nightly build of TensorBoard (tb-nightly) is compatible with the TF 2.0 preview, 1.12.2 is not expected to work.

One of the last comments suggests that the order of tensorflow-tensorboard and tensorboard matter, so you should fist

pip install tensorflow-tensorboard==1.5.1

and then

pip install tensorboard==1.14.0

Hope this helps!

Upvotes: 5

Related Questions