Skip to content

Error relative to TensorFlow / Keras versions compatibility that leads to exceptions #1183

@LucaCappelletti94

Description

@LucaCappelletti94

Hello, and thank you for making TQDM.

Recently, a compatibility error has spun up in the context of the Keras submodule, namely a compatibility error between Keras and TensorFlow versions.

The incompatibility issue takes the following form:

<module>
    from tqdm.keras import TqdmCallback
  File "/home/jtr4v/anaconda3/lib/python3.8/site-packages/tqdm/keras.py", line 9, in <module>
    import keras
  File "/home/jtr4v/anaconda3/lib/python3.8/site-packages/keras/__init__.py", line 20, in <module>
    from . import initializers
  File "/home/jtr4v/anaconda3/lib/python3.8/site-packages/keras/initializers/__init__.py", line 124, in <module>
    populate_deserializable_objects()
  File "/home/jtr4v/anaconda3/lib/python3.8/site-packages/keras/initializers/__init__.py", line 82, in populate_deserializable_objects
    generic_utils.populate_dict_with_module_objects(
AttributeError: module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'

Basically, the error is caused when Keras and TensorFlow are installed at once with incompatible versions and TQDM attempts to load Keras here.

Specifically, the aforementioned bad configuration appears to be the default one from the NVIDIA Docker Image, as available from Google Cloud.

Now, I understand this is not an error stemming from TQDM but from the configuration madness that is using Keras and TensorFlow together, so as a solution, I would suggest adding to the list of exceptions caught when attempting to load Keras also the AttributeError exception, and then attempt to load the Keras submodule from TensorFlow.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions