voxelmorph icon indicating copy to clipboard operation
voxelmorph copied to clipboard

Issue with installation and missing keras loss

Open pierre-nedelec opened this issue 10 months ago • 2 comments

Hi! I just installed the repo (after cloning the latest version) and the latest tensorflow (2.18), keras 3.8.0. Doing:

./scripts/tf/register.py --help

Returns:

.env/lib/python3.11/site-packages/neurite/tf/metrics.py", line 33, in <module>
    from tensorflow.keras.losses import mean_absolute_error as l1
ImportError: cannot import name 'mean_absolute_error' from 'tensorflow.keras.losses' (.env/lib/python3.11/site-packages/keras/_tf_keras/keras/losses/__init__.py)

Is there a specific keras version to use?

Thanks! Pierre

pierre-nedelec avatar Feb 22 '25 03:02 pierre-nedelec

same problem. hope to solve

hhhJB avatar Feb 25 '25 08:02 hhhJB

I only interacted with the library on Colab. As such I am not certain what I'll say works for you. In the main voxelmorph tutorial, there is this problem as well. To solve you can use:

!pip -q install git+https://github.com/adalca/neurite.git@0776a575eadc3d10d6851a4679b7a305f3a31c65  
!pip -q install git+https://github.com/voxelmorph/voxelmorph.git@375a1492bb8781cbbaf22f0ca2973e5121484f99

It will install the libraries but do not rely too much on the main VoxelMorph tutorial as it is now out of date and needs some modifications. These are technically not the latest versions but are the second to last commit, the last commits being inconsequential changes. I just give you what I uses and know works.

20millot avatar Mar 01 '25 05:03 20millot