Error
VERSIONS
Conda 23.9
tensorflow 2.10.0
python 3.9.18
keras 1.1.2  by pip install keras


CODE

import cv2
import numpy as np
#import tensorflow as tf
import keras
from keras.models import load_model


ERROR:
C:\Users\acer\fmd_project\fmd_script>python fmd_backend.py
Traceback (most recent call last):
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 62, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\acer\fmd_project\fmd_script\fmd_backend.py", line 196, in <module>
    import keras
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\keras\__init__.py", line 20, in <module>
    from keras import distribute
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\keras\distribute\__init__.py", line 18, in <module>
    from keras.distribute import sidecar_evaluator
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\keras\distribute\sidecar_evaluator.py", line 17, in <module>
    import tensorflow.compat.v2 as tf
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\tensorflow\__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\tensorflow\python\__init__.py", line 36, in <module>
    from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 77, in <module>
    raise ImportError(
ImportError: Traceback (most recent call last):
  File "C:\Users\acer\anaconda3\envs\base4\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 62, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.
 Please advise how to resolve this error.

Firstly should I (1) use keras which is part of tensorflow or (2) installl keras separately and import keras. Thanks

Secondly I was getting error in  the line from keras.models import load_model 
I upgraded python and tensorflow but new DLL error came as given in detail.

Thanks.  Hi @janakiashwin ,

From the attached details by you it seems you are using TF2.10v and keras 1.1.2 which is quiet old and incompatible.

If you are using tf2.10v just import tensorflow and use tf.keras. Or simply use:

`from tensorflow import keras
`

If you install any latest version of tensorflow it will install keras package also. 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/62343">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/62343">No</a>

Please go to Stack Overflow for help and support:

https://stackoverflow.com/questions/tagged/tensorflow

If you open a GitHub issue, here is our policy:

1.  It must be a bug, a feature request, or a significant problem with the
    documentation (for small docs fixes please send a PR instead).
2.  The form below must be filled out.
3.  It shouldn't be a TensorBoard issue. Those go
    [here](https://github.com/tensorflow/tensorboard/issues).

**Here's why we have that policy**: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.

------------------------

### System information

-   **Have I written custom code (as opposed to using a stock example script
    provided in TensorFlow)**:
-   **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**:
-   **Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue
    happens on a mobile device**:
-   **TensorFlow installed from (source or binary)**:
-   **TensorFlow version (use command below)**:
-   **Python version**:
-   **Bazel version (if compiling from source)**:
-   **GCC/Compiler version (if compiling from source)**:
-   **CUDA/cuDNN version**:
-   **GPU model and memory**:
-   **Exact command to reproduce**:

You can collect some of this information using our environment capture script:

https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh

You can obtain the TensorFlow version with:

```bash
python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"
```

### Describe the problem
Describe the problem clearly here. Be sure to convey here why it's a bug in TensorFlow or a feature request.

### Source code / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem.
