TotalSegmentator error at first run: "Command ‘pip’, ‘install’, ‘git+https://github.com/wasserth/TotalSegmentator.git’, ‘–no-deps’]’ returned non-zero exit status"

Hi all, I have just tried the extension and it gives me error, I copy the log for help, I have tried to update Pytorch and it also gives me error.

I think the extension is amazing the amount of elements that can be segmented, congratulations to all the team.

LOG:

Failed to compute results.

Command ‘[‘C:/Users/er_de/AppData/Local/NA-MIC/Slicer 5.2.1/bin/…/bin\PythonSlicer.EXE’, ‘-m’, ‘pip’, ‘install’, ‘git+https://github.com/wasserth/TotalSegmentator.git’, ‘–no-deps’]’ returned non-zero exit status 1.

Traceback (most recent call last):
File “C:\Users\er_de\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.py”, line 2961, in tryWithErrorDisplay
yield
File “C:/Users/er_de/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 248, in onApplyButton
self.logic.setupPythonRequirements()
File “C:/Users/er_de/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 532, in setupPythonRequirements
slicer.util.pip_install(totalSegmentatorPackage + " --no-deps" + (" --upgrade" if upgrade else “”))
File “C:\Users\er_de\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.py”, line 3571, in pip_install
_executePythonModule(‘pip’, args)
File “C:\Users\er_de\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.py”, line 3533, in _executePythonModule
logProcessOutput(proc)
File “C:\Users\er_de\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.py”, line 3502, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[‘C:/Users/er_de/AppData/Local/NA-MIC/Slicer 5.2.1/bin/…/bin\PythonSlicer.EXE’, ‘-m’, ‘pip’, ‘install’, ‘git+https://github.com/wasserth/TotalSegmentator.git’, ‘–no-deps’]’ returned non-zero exit status 1.

It might have been just a temporary problem. Please try to restart Slicer and run the segmentation again. If it still reports issues then you may get more information about the problem by installing TotalSegmentator from the Windows terminal:

"C:\Users\er_de\AppData\Local\NA-MIC\Slicer 5.2.1\bin/PythonSlicer.EXE" -m pip install git+https://github.com/wasserth/TotalSegmentator.git --no-deps

I’m having the same issue. I get the error message, but it also shows that the TotalSegmentator Python package is installing.

@tsehrhardt Please do the same - restart Slicer and try again, and if you see the error again then run the install command from the Windows terminal

"c:\users\starb\appdata\local\na-mic\Slicer 5.2.1\bin\PythonSlicer.exe" -m pip install git+https://github.com/wasserth/TotalSegmentator.git --no-deps

1 Like

Got this:

ERROR: Error [WinError 2] The system cannot find the file specified while executing command git clone -q https://github.com/wasserth/TotalSegmentator.git 'C:\Users\starb\AppData\Local\Temp\pip-req-build-2aahpc_y'
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

I also just when straight to the git for Total Segmentator to install it as a standalone and got the following:

ERROR: Cannot install totalsegmentator==1.2, totalsegmentator==1.3 and totalsegmentator==1.4.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    totalsegmentator 1.4.0 depends on SimpleITK==2.0.2
    totalsegmentator 1.3 depends on SimpleITK==2.0.2
    totalsegmentator 1.2 depends on SimpleITK==2.0.2

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

This may be the issue. Could you please install git and retry?

This is normal, TotalSegmentator must first be installed without dependencies (--no-deps), because of a SimpleITK bug. The extension implements a special technique to work around the limitation.

1 Like

That helped. It went one step further but then gave me this:
2022-12-13_11-28-26

and this:

Processing started

Writing input file to C:/Users/starb/AppData/Local/Temp/Slicer/__SlicerTemp__2022-12-13_11+27+45.797/total-segmentator-input.nii

Creating segmentations with TotalSegmentator AI...

Total Segmentator arguments: ['-i', 'C:/Users/starb/AppData/Local/Temp/Slicer/__SlicerTemp__2022-12-13_11+27+45.797/total-segmentator-input.nii', '-o', 'C:/Users/starb/AppData/Local/Temp/Slicer/__SlicerTemp__2022-12-13_11+27+45.797/segmentation', '--ml', '--task', 'total', '--fast']

File "C:\Users\starb\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Scripts\TotalSegmentator", line 10, in <module>

ModuleNotFoundError: No module named 'nibabel'

It works for me. I installed GIT and now it works perfectly.
Thank you very much for your help.

This looks great, the main problem was solved. You now need to install the extension properly. If “Upgrade” in Advanced section does not work then probably the simplest is to reinstall Slicer and TotalSegmentator.

I’ll see if I can avoid the git installation to make the installation simpler.

1 Like

It’s working now. Thank you!

Thanks for the feedbacks. I’ve added automatic detection of git and now a more meaningful message is displayed if it is not found. I’ve also implemented automatic installation of git on Windows to make the setup a bit easier.

2 Likes

3 posts were split to a new topic: TotalSegmentator error at first run: Command …Python\Scripts\TotalSegmentator… returned non-zero exit status 120

Hi Lassoan,

can you please help me, already installed the extention for the TotalSegementator, but now the slicer is not responding now, try to restart the program, and always not responding.

using the GPU 3070. there no error message, since its says successfully installed the extention, installed the git, etc.

thank you.

Could you describe in more detail what happens exactly?

Please use the CTChest demo data for a test.

image

Select the TotalSegmentator extension and press “Apply”.
Do you see any progress messages in the textbox?

image

1 Like

Hi Rudolf,

thank you for the reply, i just come from my holiday so just open the forum.

yes, i do have press the apply, and nothing happen until the error message :slight_smile:

Traceback (most recent call last):
File “C:\Users\ACER\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.py”, line 2961, in tryWithErrorDisplay
yield
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 258, in onApplyButton
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 715, in process
self.logProcessOutput(proc)
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 624, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[‘C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/bin/…/bin\PythonSlicer.EXE’, ‘C:\Users\ACER\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/ACER/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_09+44+38.651/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/ACER/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_09+44+38.651/segmentation’, ‘–ml’, ‘–task’, ‘total’]’ returned non-zero exit status 120.

any suggestion regarding this?

Does clicking on “Upgrade” button in Advanced section and restarting Slicer fixes the issue?

Do you have a GPU? How much GPU RAM does it have?

ITry to un-install the pytorch and reinstall, restarts the slicer, and now is working, but only the “fast” mode. for the non fast mode, its still got the same error.

Yes, I am Using Acer Predator with GPU RTX 3070 with 8GB RAM.

Do you use CPU or GPU pytorch?

Does your computer have multiple graphics card (e.g., Intel integrated graphics + NVIDIA discrete GPU)? Have you configured your NVIDIA settings to make Slicer use the GPU?

Do you have problems with any of the Slicer sample data sets?

Could you copy here the output in the textbox below the Apply button when you run with “Fast” checkbox disabled?

i dont have the option for the GPU, where can I install this? the option is only CPU, Automatic, and Cu80 until Cu112

this is the error message for the Fast Disabled using the sample data set CTChest:

Traceback (most recent call last):
File “C:\Users\ACER\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.py”, line 2961, in tryWithErrorDisplay
yield
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 258, in onApplyButton
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 715, in process
self.logProcessOutput(proc)
File “C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 624, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[‘C:/Users/ACER/AppData/Local/NA-MIC/Slicer 5.2.1/bin/…/bin\PythonSlicer.EXE’, ‘C:\Users\ACER\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/ACER/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_11+15+30.020/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/ACER/AppData/Local/Temp/Slicer/__SlicerTemp__2023-01-03_11+15+30.020/segmentation’, ‘–ml’, ‘–task’, ‘total’]’ returned non-zero exit status 120.

this is my Pytorch status

image