tf-nightly import fails with keras
@gpetters94 I was able to run 'import tensorflow.compat.v2 as tf' successfully on colab using tf-nightly , please find the gist [here](https://colab.research.google.com/gist/sushreebarsa/3490ac4673c9718664880c16936bacd0/61867.ipynb) and confirm the same?
Thank you! > @gpetters94 I was able to run 'import tensorflow.compat.v2 as tf' successfully on colab using tf-nightly , please find the gist [here](https://colab.research.google.com/gist/sushreebarsa/3490ac4673c9718664880c16936bacd0/61867.ipynb) and confirm the same? Thank you!

Yeah, I'm not getting it on the colab link. From looking at the `pip freeze` output there it looks like it's installing a previous version of `keras` - it's 2.13.0 there but 2.14.0 on my system. That's the one that pip pulls in, not sure why. It also seems to happen on my system with 2.13.1 and 2.12.0. @gpetters94 Thank you for your response!
Could you please try to reinstall the latest TensorFlow version 2.13 instead of nightly version with compatible version as mentioned [here](https://www.tensorflow.org/install/source#tested_build_configurations). Please let us know if it works?
Thank you!   @sushreebarsa TF 2.13 seems to work fine. @gpetters94 Thank you for the confirmation!
We recommend to use the stable one as nightly will be failing in some cases. Please let us know if we can close the issue?
Thank you! @sushreebarsa ,

As per setup.py tf-nightly needs 'keras-nightly ~= 2.15.0.dev' . It should suppose to work with keras-nightly and if not working there might be some reason for that. Instead its better to find out the reason rather than suggesting to use only stable versions. By the way nightly builds made available to community to use the up to date features and it also provides chance to fix the bugs if any.

@gpetters94 , May be you can try uninstalling existing tensorflow and keras versions and install tf-nightly and it will install keras-nightly as well. Please ensure keras-nightly version was installed. With this environment it will work. I do tested in [colab](https://colab.research.google.com/gist/JyotiPDLr/d2eea28be989794a92fca0b579899bdd/61867.ipynb) and it works fine. This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/61867">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/61867">No</a>

### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

Yes

### Source

binary

### TensorFlow version

2.15.0.dev20230914

### Custom code

No

### OS platform and distribution

Arch Linux

### Mobile device

_No response_

### Python version

Both 3.10 and 3.11

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

Running `import tensorflow.compat.v2 as tf` causes the following when keras is installed alongside tf-nightly:

```
/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/tensorflow/__init__.py:29: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptool
s or check PEP 632 for potential alternatives                                                                                                                                                  
  import distutils as _distutils                                                                                                                                                               
2023-09-14 14:47:40.395318: I external/local_tsl/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.                                                
2023-09-14 14:47:40.429289: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9511] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has alre
ady been registered                                                                                                                                                                            
2023-09-14 14:47:40.429321: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:609] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has alrea
dy been registered
2023-09-14 14:47:40.429377: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1518] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has a
lready been registered
2023-09-14 14:47:40.436510: I external/local_tsl/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2023-09-14 14:47:40.436868: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-09-14 14:47:42.270861: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/tensorflow/__init__.py", line 483, in <module>
    importlib.import_module("keras.optimizers") 
  File "/home/gap/.pyenv/versions/3.10.2-debug/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/__init__.py", line 3, in <module>
    from keras import __internal__
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/__internal__/__init__.py", line 3, in <module>
    from keras.__internal__ import backend
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/__internal__/backend/__init__.py", line 3, in <module>
    from keras.src.backend import _initialize_variables as initialize_variables
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/src/__init__.py", line 21, in <module>
    from keras.src import models
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/src/models/__init__.py", line 18, in <module>
    from keras.src.engine.functional import Functional
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/src/engine/functional.py", line 25, in <module>
    from keras.src import backend
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/src/backend.py", line 35, in <module>
    from keras.src.engine import keras_tensor
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/src/engine/keras_tensor.py", line 19, in <module>
    from keras.src.utils import object_identity
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/src/utils/__init__.py", line 20, in <module>
    from keras.src.saving.serialization_lib import deserialize_keras_object
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/src/saving/serialization_lib.py", line 28, in <module>
    from keras.src.saving.legacy.saved_model.utils import in_tf_saved_model_scope
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/src/saving/legacy/saved_model/utils.py", line 30, in <module>
    from keras.src.utils.layer_utils import CallFunctionSpec
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/src/utils/layer_utils.py", line 26, in <module>
    from keras.src import initializers
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/src/initializers/__init__.py", line 23, in <module>
    from keras.src.initializers import initializers_v1
  File "/home/gap/work/SHARK/venv2/lib/python3.10/site-packages/keras/src/initializers/initializers_v1.py", line 32, in <module>
    keras_export(
TypeError: api_export.__init__() got an unexpected keyword argument 'allow_multiple_exports'
```

### Standalone code to reproduce the issue

```shell
python3 -c 'import tensorflow.compat.v2 as tf'
```


### Relevant log output

_No response_