Total Segmentor Lung Basic BUG report on Version 5.2.2 while working perfectly on 5.2.1

Operating system:: Windows 10 Professionnel
Intel(R) Core™ i5-10505 CPU @ 3.20GHz 3.19 GHz
16Go RAM
Slicer version:5.2.2
Expected behavior:Should be working as well as on version 5.2.1 installed on the same computer using the fast method as there is no CUDA and no GPU intalled
Actual behavior:: Bug report with 5.2.2 giving this followinf message:
Failed to compute results: Command ‘[‘C:/Users/g-tnn5319433pc/AppData/Local/NA-MIC/Slicer 5.2.2/bin/…/bin\PythonSlicer.EXE’, ‘C:\Users\g-tnn5319433pc\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/g-tnn5319433pc/AppData/Local/Temp/Slicer/__SlicerTemp__2023-03-08_20+56+50.090/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/g-tnn5319433pc/AppData/Local/Temp/Slicer/__SlicerTemp__2023-03-08_20+56+50.090/segmentation’, ‘–ml’, ‘–task’, ‘total’]’ returned non-zero exit status 2.

thank you very much for your kind help
Khaldoun

You must install SlicerPytotch first and install Pytorch.
Then Restart.
The Use TotalSegmentator extension with itself installs TotalsSegmentator and sometimes finish with such an error message.
Restart Slicer, and run TS a second time, that usually fixes it.

@rbumm When you install the Slicer TotalSegmentor extension, doesn’t it automatically install the Slicer PyTorch extension dependency?

What situations require the user to manually do the process to install PyTorch?

You are right, this step is done automatically.

If I just install a TS extension in a fresh 3D Slicer 5.2.2, load a dataset and press “Apply” I still get

image

upon the first try.

Any second run or a run after a 3D Slicer restart will succeed.

I am observing an error with the TotalSegmentor (like what is shown in the above image) install due to SlicerTotalSegmentor pointing to an older TotalSegmentor version.

A TotalSegmentor dependency incorrectly specified to install sklearn from PyPI instead of scikit-learn, and TotalSegmentor updated the dependency with a fix.

@rbumm @lassoan Is there a specific need to continue using TotalSegmentor as of ecf84f9? Would it be possible to upgrade this to the v1.5.3 tag which appears to contain the sklearn fix?

The current version already contains the sklearn fix (that allowed thousands of users successfully using TotalSegmentator). That said, if you tested this new hash and everything seems to work then there is no problem with updating the git hash. Please submit a pull request! Thank you.

I don’t trust the git tag, as it can be moved to a different version and pip will not notice it. So, please use a git hash (you can add the git label as a comment).

^This hash of TotalSegmentor produced an exit error code 1 associated with trying to install the sklearn from PyPI instead of scikit-learn. I did not previously have TotalSegmentor installed in Slicer 5.2.2.

With the currently used TotalSegmentor at ecf84f9 it specifies a hard version requirement of a dependency that then specifies sklearn instead of scikit-learn. This dependency at nnunet-customized==1.2 includes the fix, but pip —upgrade is not going to make that upgrade since a specific version of this dependency is stated as being required. Maybe this exit code for sklearn doesn’t stop TotalSegmentor from working, but does show as an exit code on first running TotalSegmentor when it gets installed.

Xref Update nnunet-customized to use scikit-learn instead of sklearn · Issue #72 · wasserth/TotalSegmentator · GitHub

Thanks for the investigation. Yes, probably scikit-learn is actually not needed (similarly as matplotlib and other dependencies are not used either).

@rbumm Created a PR to update to TotalSegmentator Python package and it has been merged.

I’ve written up the following issue report about errors installing TotalSegmentor python dependencies that results in TotalSegmentor not running the first time. Upon restarting Slicer, it will detect that the TotalSegmentor python package is present and will proceed normally.

@lassoan can we not just force a restart after TS installation?