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

DentalSegmentator doesnt work #21

Closed
okoratum opened this issue Nov 26, 2024 · 13 comments · Fixed by KitwareMedical/SlicerNNUnet#11
Closed

DentalSegmentator doesnt work #21

okoratum opened this issue Nov 26, 2024 · 13 comments · Fixed by KitwareMedical/SlicerNNUnet#11

Comments

@okoratum
Copy link

okoratum commented Nov 26, 2024

I was using 3D Slicer 5.7 2024-04-25 because it is the recommended version to work with blenderfordental software.

Today i tried to use dentalsegmentator and i get error of inference folder and doesnt segment.
So i uninstall the 3D Slicer completely and tried same version and lastest version and i get this error everytime, here is the log:

2024/11/26 19:41:35.182 :: Start nnUNet install with requirements : nnunetv2
2024/11/26 19:41:35.187 :: - Installing pandas...
2024/11/26 19:41:42.688 :: - Installing pillow<10.1...
2024/11/26 19:41:47.118 :: - Installing nnunetv2 --no-deps...
2024/11/26 19:41:48.244 :: - Installing acvl-utils<0.3,>=0.2 --no-deps...
2024/11/26 19:41:48.964 :: - Installing batchgenerators --no-deps...
2024/11/26 19:41:49.915 :: - Installing scikit-image --no-deps...
2024/11/26 19:41:51.590 :: - Installing networkx>=2.8 --no-deps...
2024/11/26 19:41:53.860 :: - Installing imageio>=2.33 --no-deps...
2024/11/26 19:41:54.776 :: - Installing tifffile>=2022.8.12 --no-deps...
2024/11/26 19:41:55.791 :: - Installing lazy-loader>=0.4 --no-deps...
2024/11/26 19:41:56.504 :: - Installing scikit-learn --no-deps...
2024/11/26 19:41:59.316 :: - Installing joblib>=1.2.0 --no-deps...
2024/11/26 19:42:00.224 :: - Installing threadpoolctl>=3.1.0 --no-deps...
2024/11/26 19:42:01.059 :: - Installing future --no-deps...
2024/11/26 19:42:02.205 :: - Installing unittest2 --no-deps...
2024/11/26 19:42:03.207 :: - Installing argparse --no-deps...
2024/11/26 19:42:04.062 :: - Installing traceback2 --no-deps...
2024/11/26 19:42:04.816 :: - Installing linecache2 --no-deps...
2024/11/26 19:42:05.546 :: - Installing connected-components-3d --no-deps...
2024/11/26 19:42:06.328 :: - Installing blosc2>=3.0.0b4 --no-deps...
2024/11/26 19:42:07.080 :: Install returned non-zero exit status : Command '['C:/Users/PC/AppData/Local/slicer.org/Slicer 5.7.0-2024-11-25/bin/../bin\PythonSlicer.EXE', '-m', 'pip', 'install', 'blosc2>=3.0.0b4', '--no-deps']' returned non-zero exit status 1.. Attempting to continue...
2024/11/26 19:42:07.085 :: Error occurred during install : blosc2

I pressed apply again in hope it will fix itself and i am stuck at download model weights for a while.

I restarted the app and installed pytorch compatible with my gpu in pytorchutils extension and run the extension again and then i got different error, here is the log:

2024/11/26 20:01:45.238 :: nnUNet is already installed (2.5.1) and compatible with requested version (nnunetv2).
2024/11/26 20:01:48.296 :: Transferring volume to nnUNet in C:/Users/PC/AppData/Local/Temp/Slicer-RuOTvc
2024/11/26 20:02:06.380 :: Starting nnUNet with the following parameters:
2024/11/26 20:02:06.380 ::
2024/11/26 20:02:06.380 :: C:\Users\PC\AppData\Local\slicer.org\Slicer 5.7.0-2024-11-25\lib\Python\Scripts\nnUNetv2_predict.exe -i C:/Users/PC/AppData/Local/Temp/Slicer-RuOTvc/input -o C:/Users/PC/AppData/Local/Temp/Slicer-RuOTvc/output -d Dataset111_453CT -tr nnUNetTrainer -p nnUNetPlans -c 3d_fullres -f 0 -npp 1 -nps 1 -step_size 0.5 -device cuda -chk checkpoint_final.pth --disable_tta
2024/11/26 20:02:06.380 ::
2024/11/26 20:02:06.380 :: JSON parameters :
2024/11/26 20:02:06.380 :: {
2024/11/26 20:02:06.380 :: "folds": "0",
2024/11/26 20:02:06.380 :: "device": "cuda",
2024/11/26 20:02:06.380 :: "stepSize": 0.5,
2024/11/26 20:02:06.380 :: "disableTta": true,
2024/11/26 20:02:06.380 :: "nProcessPreprocessing": 1,
2024/11/26 20:02:06.380 :: "nProcessSegmentationExport": 1,
2024/11/26 20:02:06.380 :: "checkPointName": "",
2024/11/26 20:02:06.380 :: "modelPath": {
2024/11/26 20:02:06.380 :: "_path": "C:\Users\PC\AppData\Local\slicer.org\Slicer 5.7.0-2024-11-25\slicer.org\Extensions-33123\DentalSegmentator\lib\Slicer-5.7\qt-scripted-modules\Resources\ML"
2024/11/26 20:02:06.380 :: }
2024/11/26 20:02:06.380 :: }
2024/11/26 20:02:06.405 :: nnUNet preprocessing...
2024/11/26 20:02:08.233 :: Traceback (most recent call last):
2024/11/26 20:02:08.233 :: File "C:\Users\PC\AppData\Local\slicer.org\Slicer 5.7.0-2024-11-25\lib\Python\Lib\runpy.py", line 197, in _run_module_as_main
2024/11/26 20:02:08.234 :: return _run_code(code, main_globals, None,
2024/11/26 20:02:08.234 :: File "C:\Users\PC\AppData\Local\slicer.org\Slicer 5.7.0-2024-11-25\lib\Python\Lib\runpy.py", line 87, in run_code
2024/11/26 20:02:08.234 :: exec(code, run_globals)
2024/11/26 20:02:08.234 :: File "C:\Users\PC\AppData\Local\slicer.org\Slicer 5.7.0-2024-11-25\lib\Python\Scripts\nnUNetv2_predict.exe_main
.py", line 4, in
2024/11/26 20:02:08.234 :: File "C:\Users\PC\AppData\Local\slicer.org\Slicer 5.7.0-2024-11-25\lib\Python\Lib\site-packages\nnunetv2\inference\predict_from_raw_data.py", line 18, in
2024/11/26 20:02:08.234 :: from tqdm import tqdm
2024/11/26 20:02:08.234 :: ModuleNotFoundError: No module named 'tqdm'
2024/11/26 20:02:08.469 :: Loading inference results...
2024/11/26 20:02:10.316 :: Error loading results :
2024/11/26 20:02:10.316 :: Failed to load the segmentation.
2024/11/26 20:02:10.316 :: Something went wrong during the nnUNet processing.
2024/11/26 20:02:10.316 :: Please check the logs for potential errors and contact the library maintainers.

My PC Specs:

Windows 11
Ryzen 7 7700X
32GB Ram
RTX 4070

@okoratum
Copy link
Author

okoratum commented Nov 26, 2024

So everytime i get error that something isnt installed, so i kept installing all the dependencies that the extension told and it worked.

But Before that, i went to pytorchutils to install pytorch compatible with my gpu.

Here what i typed in the python console:

pip_install("tqdm")
pip_install("blosc2")
pip_install("nibabel")
pip_install("dynamic_network_architectures")
pip_install("batchgeneratorsv2")
pip_install("matplotlib")
pip_install("seaborn")

@GauthierDot
Copy link
Collaborator

GauthierDot commented Nov 28, 2024

Hi @okoratum
Thank you for reporting this issue.
This problem comes from acvl_utils recent release and is currently open on the nnUNet repository : MIC-DKFZ/nnUNet#2589

The current work around is to downgrade acvl_utils to version 0.2, you can do that by using the python 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.

Best
Gauthier

@okoratum
Copy link
Author

Thanks for the quick reply.

I saw previous post about this and typed this command but didnt work for me.
I will try with this command, should i install pytorch first before this command to get version compatible with my gpu?

@GauthierDot
Copy link
Collaborator

Thank you for your reply.
You should install DentalSegmentator following the normal process. Then, you click on the Python icon on the upper right corner of 3D Slicer ; paste slicer.util.pip_install("acvl_utils==0.2") command in the Python Console and press enter.

@drgrillo
Copy link

drgrillo commented Dec 8, 2024

Same for me, but the acvl_utils command in Pyhton did not solve the issue. How do I proceed?

@Thibault-Pelletier
Copy link
Collaborator

Hi @drgrillo ,

This problem is still linked to acvl_utils for Python 3.9.
It currently impacts TotalSegmentator and DentalSegmentator.

An issue was opened by James Butler on the acvl_utils repo here : MIC-DKFZ/acvl_utils#4

You can follow the related issue on Slicer here : https://discourse.slicer.org/t/dental-segmantator/40519/2

@crosswick
Copy link

So... is it not possible to use DentalSegmentator at all at the moment?

What I have tried is:

  • uninstall DentalSegmentator and all related extensions & restart
  • install DentalSegmentator & restart
  • run slicer.util.pip_install("acvl_utils==0.2") in the Python Console
  • load the CBCTDentalSurgery demo
  • bring up DentalSegmentator, click Apply

error: module not found 'tqdm'

@okoratum
Copy link
Author

Hello Everyone

https://youtu.be/3YgLI7lMhXE

Here is what i did to make DentalSegmentator work with the python command that @GauthierDot told us about.

Python code:

slicer.util.pip_install("acvl_utils==0.2")

I hope it solves your problem and it is better to uninstall and reinstall 3d slicer 5.7 again.

@crosswick
Copy link

crosswick commented Dec 22, 2024

I have tried again following okoratum's advice of reinstalling Slicer too - nice video by the way.

Unfortunately I still get errors, this is with the CBCTDentalSurgery demo:

image

with importing a different DICOM set the tqdm error re-appears.

Perhaps a bunch of dependencies don't get cleaned up properly by reinstalling the extension and Slicer?
I do remember seeing a warning in a similar fashion.

I'll try updating my Nvidia drivers, perhaps there is an issue.

@okoratum
Copy link
Author

@crosswick

What i did is that i completely uninstalled 3D Slicer, and i used a third party application uninstaller called "Revo Uninstaller", or any third-party uninstaller to ensure that all leftover files of the application are removed along with 3D slicer, and did what i have shown in the video.

Hope it works for you and keep me updated as some people still have problem with this.

Regarding Nvidia drivers, yes it will boost segmentation speed but install drivers only without GeForce experience or the new application as it may cause bugs.

@drgrillo
Copy link

For me using Revo Uinstaller was a suitable option.
It works now.
Thank @okoratum and @GauthierDot

@nlmarinov
Copy link

Опитах се отново, следвайки съвета на okoratum да преинсталирам и Slicer - хубаво видео между другото.

За съжаление все още получавам грешки, това е с демонстрацията на CBCTDentalSurgery:

изображение

при импортиране на различна DICOM настройка грешката tqdm се появява отново.

Може би куп зависимости не се почистват правилно чрез преинсталиране на разширението и Slicer? Спомням си, че видях предупреждение по подобен начин.

Ще се опитам да актуализирам драйверите си за Nvidia, може би има проблем.

I have the same problem and I can't solve it no matter how many times I reinstall everything. The program apparently starts working but somehow it ends up in a dead end in the same way you show in the picture.

@nlmarinov
Copy link

Thanks for the guidance! After carefully reading and examining what you directed me to, I entered the following lines into the python console.
pip_install("TQDM")
pip_install("blosc2")
pip_install("nibabel")
pip_install("dynamic_network_architectures")
pip_install("batchgeneratorsv2")
pip_install("matplotlib")
pip_install("Seaborn")

After a few days of being nervous. I didn't believe I would see this program work, but now everything works perfectly!

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

Successfully merging a pull request may close this issue.

6 participants