Skip to content

Import issue with Keras nightly after 3/25 #220

@gkroiz

Description

@gkroiz

System information.

  • Have I written custom code (as opposed to using a stock example script provided in Keras): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 22.04.2 LTS
  • TensorFlow installed from (source or binary): pip3 tf-nightly
  • TensorFlow version (use command below): v1.12.1-92665-g26da3100020 2.13.0-dev20230414
  • Python version: Python 3.10.6
  • Bazel version (if compiling from source): N/A
  • GPU model and memory: N/A (using TPU but I don't think that is important here)
  • Exact command to reproduce: python3 -c 'from keras.utils import tf_utils;

Describe the problem.
When using keras-nightly from 3/25 to present day results in an import issue with from keras.utils import tf_utils: ImportError: cannot import name 'tf_utils' from 'keras.utils' (/usr/local/lib/python3.10/dist-packages/keras/utils/__init__.py). However, from keras.src.utils import tf_utils works. This is an issue for existing repos that rely on the old import structure. I realize the readme mentions there is no support for backward compatibility in nightly builds. Keeping this in mind, is this change intentional or a bug? If this is intentional, then perhaps the fix needs to be implemented in repos that rely on this import, not keras.

Describe the current behavior.
Import error

Describe the expected behavior.
No import error

Contributing.

  • Do you want to contribute a PR? (yes/no): I would be happy to if this is indeed a keras bug.
  • If yes, please read this page for instructions
  • Briefly describe your candidate solution(if contributing): N/A

Standalone code to reproduce the issue.

pip3 install tf-nightly
python3 -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions