gaudot / SlicerDentalSegmentator

3D Slicer extension for fully-automatic segmentation of CT and CBCT dental volumes.
Apache License 2.0
64 stars 7 forks source link

ModuleNotFoundError: No module named 'acvl_utils' during nnUNet processing #20

Open m-hajiabadi opened 1 day ago

m-hajiabadi commented 1 day ago

I encountered a ModuleNotFoundError for the acvl_utils module when using the extension. However, the module is already installed in the environment. Despite this, the inference step fails with the following error:

Error Logs

2024/11/17 11:33:48.417 :: Start nnUNet install with requirements : nnunetv2 2024/11/17 11:33:48.428 :: - Installing pandas... 2024/11/17 11:34:18.861 :: - Installing pillow<10.1... 2024/11/17 11:34:38.765 :: - Installing nnunetv2 --no-deps... 2024/11/17 11:34:44.191 :: - Installing acvl-utils<0.3,>=0.2 --no-deps... 2024/11/17 11:34:47.756 :: - Installing batchgenerators --no-deps... 2024/11/17 11:34:49.859 :: - Installing scikit-image --no-deps... 2024/11/17 11:34:58.262 :: - Installing networkx>=2.8 --no-deps... 2024/11/17 11:35:06.580 :: - Installing imageio>=2.33 --no-deps... 2024/11/17 11:35:09.456 :: - Installing tifffile>=2022.8.12 --no-deps... 2024/11/17 11:35:12.253 :: - Installing lazy-loader>=0.4 --no-deps... 2024/11/17 11:35:14.377 :: - Installing scikit-learn --no-deps... 2024/11/17 11:35:27.588 :: - Installing joblib>=1.2.0 --no-deps... 2024/11/17 11:35:30.804 :: - Installing threadpoolctl>=3.1.0 --no-deps... 2024/11/17 11:35:33.073 :: - Installing future --no-deps... 2024/11/17 11:35:37.229 :: - Installing unittest2 --no-deps... 2024/11/17 11:35:40.664 :: - Installing argparse --no-deps... 2024/11/17 11:35:42.555 :: - Installing traceback2 --no-deps... 2024/11/17 11:35:44.966 :: - Installing linecache2 --no-deps... 2024/11/17 11:35:47.387 :: - Installing connected-components-3d --no-deps... 2024/11/17 11:35:49.858 :: - Installing blosc2>=3.0.0b4 --no-deps... 2024/11/17 11:35:51.616 :: Install returned non-zero exit status : Command '['C:/Users/hajia/AppData/Local/slicer.org/Slicer 5.7.0-2024-11-14/bin/../bin\PythonSlicer.EXE', '-m', 'pip', 'install', 'blosc2>=3.0.0b4', '--no-deps']' returned non-zero exit status 1.. Attempting to continue... 2024/11/17 11:35:51.630 :: Error occurred during install : blosc2 2024/11/17 11:54:39.503 :: nnUNet is already installed (2.5.1) and compatible with requested version (nnunetv2). 2024/11/17 11:54:39.516 :: Downloading model weights... 2024/11/17 12:24:49.885 :: nnUNet is already installed (2.5.1) and compatible with requested version (nnunetv2). 2024/11/17 12:24:49.894 :: Downloading model weights... 2024/11/17 12:26:01.125 :: Transferring volume to nnUNet in C:/Users/hajia/AppData/Local/Temp/Slicer-AVQZug 2024/11/17 12:26:02.234 :: Starting nnUNet with the following parameters: 2024/11/17 12:26:02.234 :: 2024/11/17 12:26:02.234 :: C:\Users\hajia\AppData\Local\slicer.org\Slicer 5.7.0-2024-11-14\lib\Python\Scripts\nnUNetv2_predict.exe -i C:/Users/hajia/AppData/Local/Temp/Slicer-AVQZug/input -o C:/Users/hajia/AppData/Local/Temp/Slicer-AVQZug/output -d Dataset111_453CT -tr nnUNetTrainer -p nnUNetPlans -c 3d_fullres -f 0 -npp 1 -nps 1 -step_size 0.5 -device cpu -chk checkpoint_final.pth --disable_tta 2024/11/17 12:26:02.234 :: 2024/11/17 12:26:02.234 :: JSON parameters : 2024/11/17 12:26:02.234 :: { 2024/11/17 12:26:02.234 :: "folds": "0", 2024/11/17 12:26:02.234 :: "device": "cpu", 2024/11/17 12:26:02.234 :: "stepSize": 0.5, 2024/11/17 12:26:02.234 :: "disableTta": true, 2024/11/17 12:26:02.234 :: "nProcessPreprocessing": 1, 2024/11/17 12:26:02.234 :: "nProcessSegmentationExport": 1, 2024/11/17 12:26:02.234 :: "checkPointName": "", 2024/11/17 12:26:02.234 :: "modelPath": { 2024/11/17 12:26:02.234 :: "_path": "C:\Users\hajia\AppData\Local\slicer.org\Slicer 5.7.0-2024-11-14\slicer.org\Extensions-33112\DentalSegmentator\lib\Slicer-5.7\qt-scripted-modules\Resources\ML" 2024/11/17 12:26:02.234 :: } 2024/11/17 12:26:02.234 :: } 2024/11/17 12:26:02.244 :: nnUNet preprocessing... 2024/11/17 12:26:15.718 :: Traceback (most recent call last): 2024/11/17 12:26:15.718 :: File "C:\Users\hajia\AppData\Local\slicer.org\Slicer 5.7.0-2024-11-14\lib\Python\Lib\runpy.py", line 197, in _run_module_as_main 2024/11/17 12:26:15.722 :: return _run_code(code, main_globals, None, 2024/11/17 12:26:15.722 :: File "C:\Users\hajia\AppData\Local\slicer.org\Slicer 5.7.0-2024-11-14\lib\Python\Lib\runpy.py", line 87, in _run_code 2024/11/17 12:26:15.722 :: exec(code, run_globals) 2024/11/17 12:26:15.722 :: File "C:\Users\hajia\AppData\Local\slicer.org\Slicer 5.7.0-2024-11-14\lib\Python\Scripts\nnUNetv2_predict.exe__main__.py", line 4, in 2024/11/17 12:26:15.722 :: File "C:\Users\hajia\AppData\Local\slicer.org\Slicer 5.7.0-2024-11-14\lib\Python\Lib\site-packages\nnunetv2\inference\predict_from_raw_data.py", line 11, in 2024/11/17 12:26:15.722 :: from acvl_utils.cropping_and_padding.padding import pad_nd_image 2024/11/17 12:26:15.722 :: ModuleNotFoundError: No module named 'acvl_utils' 2024/11/17 12:26:16.331 :: Loading inference results... 2024/11/17 12:26:33.104 :: Error loading results : 2024/11/17 12:26:33.104 :: Failed to load the segmentation. 2024/11/17 12:26:33.104 :: Something went wrong during the nnUNet processing. 2024/11/17 12:26:33.104 :: Please check the logs for potential errors and contact the library maintainers.

Environment Information

Could you confirm if this is an issue with the extension's environment setup or provide guidance on ensuring the acvl_utils module is properly recognized?

Thibault-Pelletier commented 11 hours ago

Hi @m-hajiabadi, Thank you for reporting this issue. This problem comes from acvl_utils recent release and is currently open on the nnUNet repository : https://github.com/MIC-DKFZ/nnUNet/issues/2589

The current work around is to downgrade acvl_utils to version 0.2 (you can do that by using the command slicer.util.pip_install("acvl_utils==0.2")

Ensuring the correct version of the acvl_utils package is the responsibility of the nnUNet library so we are waiting for a fix on their side.