keras
keras copied to clipboard
Module not found errors 3.4.1
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'
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'
Can you please install latest Keras version and you can use TensorFlow as a backend. https://anaconda.org/conda-forge/keras
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.
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
you can do keras.src.layers in that case
you can do
keras.src.layersin that case
I really can do by this, but import parts of many codes must be modified. are you serious?
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.
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.
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.
Hi @O-Memis,
Are you still able to reproduce the issue ? If yes, could you please try upgrading to the latest version of Keras(3.7.0). Thanks!
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.
This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.
I also have a fresh Spyder install and have the same issue after installing latest Keras version: conda install conda-forge::keras
It seams the error is in the optree library. I can also reproduce all the steps as @WilliamQue (https://github.com/keras-team/keras/issues/20103#issuecomment-2294912797)