keras-team / keras

Deep Learning for humans
http://keras.io/
Apache License 2.0
61.62k stars 19.42k forks source link

Module not found errors 3.4.1 #20103

Open O-Memis opened 1 month ago

O-Memis commented 1 month ago

Not useful. After I updated my libraries in Anaconda, all of my Keras codes started to give dramatic errors. I can import the Keras, but can not use it! I re-installed but the situation is same. I don't know how the dependencies or methods changed, but you should consider how people are using these. Now I have to install a previous version, but which one?

ModuleNotFoundError: No module named 'keras.layers' ModuleNotFoundError: No module named 'keras.optimizers' ModuleNotFoundError: No module named 'keras.regularizers' ModuleNotFoundError: No module named 'tensorflow.keras'

O-Memis commented 1 month ago

I checked and renewed all the libraries, I used pip cache purge, then I installed 2.15.0 for both tensorflow and keras. But different kinds of errors are still occurring. Other versions also did not helped.

Code: import keras Error: ModuleNotFoundError: No module named 'tensorflow.compat'

Code: print(tf.version) Error: AttributeError: module 'tensorflow' has no attribute 'version'

sachinprasadhs commented 1 month ago

Can you please install latest Keras version and you can use TensorFlow as a backend. https://anaconda.org/conda-forge/keras

O-Memis commented 1 month ago

I have already installed the latest versions of them. It was already 3.4.1 , what is the difference of "conda install conda-forge::keras" ?? I showed the errors in my first message. Now I am using TensorFlow & keras 2.10 without any problems, for now.

sachinprasadhs commented 1 month ago

Could you please try by creating a fresh environment and install the Keras/TensorFlow latest package and import the package as below

import keras
from keras import layers, optimizers, regularizers 
WilliamQue commented 1 month ago

image

sachinprasadhs commented 4 weeks ago

you can do keras.src.layers in that case

WilliamQue commented 3 weeks ago

you can do keras.src.layers in that case

I really can do by this, but import parts of many codes must be modified. are you serious?

sachinprasadhs commented 3 weeks ago

I don't see any issues when I try from my side, here is the working Gist https://colab.sandbox.google.com/gist/sachinprasadhs/257ce4b5995bbba7ad526cb7c045734b/20103.ipynb.

Note: We only release PyPi Keras package as our official release, all other releases are not maintained or released by us.

github-actions[bot] commented 1 week ago

This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

O-Memis commented 1 week ago

I haven't tried the suggestion in a fresh environment yet, As I said before, I reinstalled TensorFlow & keras 2.10 without any problems, for now. I can share the list of all the libraries with versions, if you want.