Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'keras.src.legacy' #26

Open
MammadTavakoli opened this issue May 9, 2024 · 1 comment
Open

ModuleNotFoundError: No module named 'keras.src.legacy' #26

MammadTavakoli opened this issue May 9, 2024 · 1 comment

Comments

@MammadTavakoli
Copy link

I must use tensorflow 2.14.0 for my work. But when I run it show the folowing error :

from .models import create_model, create_model_2_model_padding, create_model_2_model, create_model_2_model_patch_size
  File "F:\_brain\_code\_code_one_by_one\modules\models.py", line 23, in <module>
    from classification_models_3D.kkeras import Classifiers
  File "C:\ProgramData\anaconda3\Lib\site-packages\classification_models_3D\kkeras.py", line 2, in <module>
    from .models_factory import ModelsFactory
  File "C:\ProgramData\anaconda3\Lib\site-packages\classification_models_3D\models_factory.py", line 3, in <module>
    from .models import resnet as rn
  File "C:\ProgramData\anaconda3\Lib\site-packages\classification_models_3D\models\resnet.py", line 5, in <module>
    from ._common_blocks import ChannelSE
  File "C:\ProgramData\anaconda3\Lib\site-packages\classification_models_3D\models\_common_blocks.py", line 2, in <module>
    from keras.src.legacy.backend import int_shape
ModuleNotFoundError: No module named 'keras.src.legacy'

How can solve the problem.

with tensorflow 2.16.1 it works well

@nicolas-combaret
Copy link
Contributor

Hello,

If you use tensorflow==2.14.0, then it comes with keras==2.14.0. You can force the installation of keras>=3 but there is no guarantee that it will work smoothly (keras>=3 requires tensorflow>=2.16.1).
Therefore, you can't use the last version 1.10 of segmentation_models_3D since it works with keras>=3 only. The last version working with prior keras version is noted in the README page: https://github.com/ZFTurbo/classification_models_3D?tab=readme-ov-file#older-versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants