# TotalSegmentator error at first run: returned non-zero exit status 120.

**URL:** https://discourse.slicer.org/t/totalsegmentator-error-at-first-run-returned-non-zero-exit-status-120/34439
**Category:** Support
**Tags:** segmentation
**Created:** [February 20, 2024, 11:22pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-at-first-run-returned-non-zero-exit-status-120/34439 "2024-02-20T23:22:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Rolling](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rolling/32/69413_2.png) [@Rolling](https://discourse.slicer.org/u/Rolling)
#### Post date: [February 20, 2024, 11:22pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-at-first-run-returned-non-zero-exit-status-120/34439/1 "2024-02-20T23:22:52Z")

</div>

Dear all

I tried to use the TotalSegmentator in 3D slicer, but I got an error：

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/4/74934427f10cffbcb05400fca1c25e51f1e1277a.png)

Failed to compute results.

Traceback (most recent call last):  
File “E:\3D Slicer\Slicer 5.6.1\bin\Python\slicer\util.py”, line 3255, in tryWithErrorDisplay  
yield  
File “E:/3D Slicer/Slicer 5.6.1/slicer.org/Extensions-32438/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py”, line 292, in onApplyButton  
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),  
File “E:/3D Slicer/Slicer 5.6.1/slicer.org/Extensions-32438/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py”, line 967, in process  
self.logProcessOutput(proc)  
File “E:/3D Slicer/Slicer 5.6.1/slicer.org/Extensions-32438/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py”, line 787, in logProcessOutput  
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)  
subprocess.CalledProcessError: Command ‘[‘E:/3D Slicer/Slicer 5.6.1/bin/…/bin\PythonSlicer.EXE’, ‘E:\3D Slicer\Slicer 5.6.1\lib\Python\Scripts\TotalSegmentator.exe’, ‘-i’, ‘C:/Users/xrnyy/AppData/Local/Temp/Slicer/\_\_SlicerTemp\_\_2024-02-20\_22+51+14.310/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/xrnyy/AppData/Local/Temp/Slicer/\_\_SlicerTemp\_\_2024-02-20\_22+51+14.310/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]’ returned non-zero exit status 120.

Then the error reported under the “Apply” button :

Processing started  
Writing input file to C:/Users/xrnyy/AppData/Local/Temp/Slicer/\_\_SlicerTemp\_\_2024-02-20\_22+51+14.310/total-segmentator-input.nii  
Creating segmentations with TotalSegmentator AI…  
Total Segmentator arguments: [‘-i’, ‘C:/Users/xrnyy/AppData/Local/Temp/Slicer/\_\_SlicerTemp\_\_2024-02-20\_22+51+14.310/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/xrnyy/AppData/Local/Temp/Slicer/\_\_SlicerTemp\_\_2024-02-20\_22+51+14.310/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]  
Traceback (most recent call last):  
File “E:\3D Slicer\Slicer 5.6.1\lib\Python\Lib\runpy.py”, line 197, in \_run\_module\_as\_main  
return \_run\_code(code, main\_globals, None,  
File “E:\3D Slicer\Slicer 5.6.1\lib\Python\Lib\runpy.py”, line 87, in _run\_code  
exec(code, run\_globals)  
File "E:\3D Slicer\Slicer 5.6.1\lib\Python\Scripts\TotalSegmentator.exe\_main_.py", line 7, in   
File “E:\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\totalsegmentator\bin\TotalSegmentator.py”, line 127, in main  
totalsegmentator(args.input, args.output, args.ml, args.nr\_thr\_resamp, args.nr\_thr\_saving,  
File “E:\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\totalsegmentator\python\_api.py”, line 77, in totalsegmentator  
from totalsegmentator.nnunet import nnUNet\_predict\_image # this has to be after setting new env vars  
File “E:\3D Slicer\Slicer 5.6.1\lib\Python\Lib\site-packages\totalsegmentator\nnunet.py”, line 23, in   
from nnunetv2.inference.predict\_from\_raw\_data import predict\_from\_raw\_data  
ModuleNotFoundError: No module named ‘nnunetv2’  
Exception ignored in: \<totalsegmentator.libs.DummyFile object at 0x000002840C2953A0\>  
AttributeError: ‘DummyFile’ object has no attribute ‘flush’

If you use this tool please cite: [https://pubs.rsna.org/doi/10.1148/ryai.230024](https://pubs.rsna.org/doi/10.1148/ryai.230024)

Thank you very much for the support!

---

<div class="post-metadata">

### Author: ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)
#### Post date: [February 20, 2024, 11:55pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-at-first-run-returned-non-zero-exit-status-120/34439/2 "2024-02-20T23:55:21Z")

</div>

Please see the following post regarding a required workaround. Note this may change as the various dependencies of the `TotalSegmentator` python package change.

> [@Totalsegmentator failing with error 120](https://discourse.slicer.org/t/totalsegmentator-failing-with-error-120/34434/11):
>
> Aha! So, it is not a too old package, but a too recent package. Unfortunately, developer of dynamic\_network\_architectures broke backward compatibility with a recent update. ResidualEncoderUNet package must be imported as from dynamic\_network\_architectures.architectures.residual\_unet import ResidualEncoderUNet now, but since this change was snuck into a minor version update (0.2 to 0.4) developer of TotalSegmentator did not suspect anything bad would happen. As a workaround, you can downgrade d…
