# TotalSegmentator ERROR failed to compute result - returned non-zero exit status 120

**URL:** <https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600>\
**Category:** Support\
**Created:** [May 23, 2023, 11:06am UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600 "2023-05-23T11:06:32Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmjones](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@cmjones](https://discourse.slicer.org/u/cmjones)\
**Post date:** [May 23, 2023, 11:06am UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/1 "2023-05-23T11:06:33Z")

</div>

When I run totalsegmentator on 3D slicer using the CTA Abdomen (panoramix) sample data it comes with the following error. I have tried uninstalling 3D slicer/PyTorch/totalsegmentator numerous times with no luck.

Operating system: macOS Monterey 12.5.1 (Apple M1 chip)  
Slicer version: 5.2.2  
Expected behavior: totalsegmentator  
Actual behavior: ERROR when running apply

"Processing started  
Writing input file to /private/var/folders/n4/\_8hf03v543x\_q3b0k017wbfm0000gp/T/Slicer-mosc7cj2/\_\_SlicerTemp\_\_2023-05-23\_10+25+00.631/total-segmentator-input.nii  
Creating segmentations with TotalSegmentator AI…  
Total Segmentator arguments: [‘-i’, ‘/private/var/folders/n4/\_8hf03v543x\_q3b0k017wbfm0000gp/T/Slicer-mosc7cj2/\_\_SlicerTemp\_\_2023-05-23\_10+25+00.631/total-segmentator-input.nii’, ‘-o’, ‘/private/var/folders/n4/\_8hf03v543x\_q3b0k017wbfm0000gp/T/Slicer-mosc7cj2/\_\_SlicerTemp\_\_2023-05-23\_10+25+00.631/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]  
/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/torch/cuda/amp/grad\_scaler.py:116: UserWarning: torch.cuda.amp.GradScaler is enabled, but CUDA is not available. Disabling.  
warnings.warn(“torch.cuda.amp.GradScaler is enabled, but CUDA is not available. Disabling.”)  
/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/torch/cuda/amp/autocast\_mode.py:118: UserWarning: torch.cuda.amp.autocast only affects CUDA ops, but CUDA is not available. Disabling.  
warnings.warn(“torch.cuda.amp.autocast only affects CUDA ops, but CUDA is not available. Disabling.”)  
Traceback (most recent call last):  
File “/Applications/Slicer.app/Contents/lib/Python/bin/TotalSegmentator”, line 93, in   
main()  
File “/Applications/Slicer.app/Contents/lib/Python/bin/TotalSegmentator”, line 86, in main  
totalsegmentator(args.input, args.output, args.ml, args.nr\_thr\_resamp, args.nr\_thr\_saving,  
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/totalsegmentator/python\_api.py”, line 173, in totalsegmentator  
seg = nnUNet\_predict\_image(input, output, task\_id, model=model, folds=folds,  
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/totalsegmentator/nnunet.py”, line 255, in nnUNet\_predict\_image  
nnUNet\_predict(tmp\_dir, tmp\_dir, task\_id, model, folds, trainer, tta)  
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/totalsegmentator/nnunet.py”, line 106, in nnUNet\_predict  
predict\_from\_folder(model\_folder\_name, dir\_in, dir\_out, folds, save\_npz, num\_threads\_preprocessing,  
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/nnunet/inference/predict.py”, line 668, in predict\_from\_folder  
return predict\_cases\_fastest(model, list\_of\_lists[part\_id::num\_parts], output\_files[part\_id::num\_parts], folds,  
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/nnunet/inference/predict.py”, line 493, in predict\_cases\_fastest  
res = trainer.predict\_preprocessed\_data\_return\_seg\_and\_softmax(d, do\_mirroring=do\_tta,  
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/nnunet/training/network\_training/nnUNetTrainerV2.py”, line 211, in predict\_preprocessed\_data\_return\_seg\_and\_softmax  
ret = super().predict\_preprocessed\_data\_return\_seg\_and\_softmax(data,  
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/nnunet/training/network\_training/nnUNetTrainer.py”, line 516, in predict\_preprocessed\_data\_return\_seg\_and\_softmax  
ret = self.network.predict\_3D(data, do\_mirroring=do\_mirroring, mirror\_axes=mirror\_axes,  
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/nnunet/network\_architecture/neural\_network.py”, line 147, in predict\_3D  
res = self.\_internal\_predict\_3D\_3Dconv\_tiled(x, step\_size, do\_mirroring, mirror\_axes, patch\_size,  
File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages/nnunet/network\_architecture/neural\_network.py”, line 348, in \_internal\_predict\_3D\_3Dconv\_tiled  
gaussian\_importance\_map[gaussian\_importance\_map == 0] = gaussian\_importance\_map[  
RuntimeError: “min\_all” not implemented for ‘Half’  
Exception ignored in: \<totalsegmentator.libs.DummyFile object at 0x1b765f5b0\>  
AttributeError: ‘DummyFile’ object has no attribute ‘flush’

If you use this tool please cite: [https://doi.org/10.48550/arXiv.2208.05868](https://doi.org/10.48550/arXiv.2208.05868)

No GPU detected. Running on CPU. This can be very slow. The ‘–fast’ option can help to some extend.  
Using ‘fast’ option: resampling to lower resolution (3mm)  
Resampling…  
Resampled in 4.13s  
Predicting…"

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 23, 2023, 11:08am UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/2 "2023-05-23T11:08:02Z")

</div>

Could you please go to Pytorch Utils module and copy here the installed pytorch version?

---

<div class="post-metadata">

**Author:** ![cmjones](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@cmjones](https://discourse.slicer.org/u/cmjones)\
**Post date:** [May 23, 2023, 11:10am UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/3 "2023-05-23T11:10:27Z")

</div>

Pytorch version 1.8.1

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 23, 2023, 1:13pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/4 "2023-05-23T13:13:48Z")

</div>

Could you also write us the NVIDIA driver version (line below PyTorch version in PyTorch Utils module).

The problem is that TotalSegmentator requires pytorch\>=2 (see more information [here](https://github.com/fepegar/SlicerPyTorch/issues/9)). You can fix this by installing pytorch manually as described [here](https://pytorch.org/get-started/locally/) - just use `PythonSlicer` executable instead of `pip3`.

---

<div class="post-metadata">

**Author:** ![cmjones](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@cmjones](https://discourse.slicer.org/u/cmjones)\
**Post date:** [May 23, 2023, 6:53pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/5 "2023-05-23T18:53:48Z")

</div>

NVIDIA driver: not found

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 23, 2023, 7:43pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/6 "2023-05-23T19:43:08Z")

</div>

Thanks for the information. I was wondering if pytorch-1.8.1 is enforced by some old GPU driver, but apparently not.

Anyway, until we figure out why an old pytorch version is installed on some computers, you can install pytorch-2.x in your Slicer to make TotalSegmentator work.

---

<div class="post-metadata">

**Author:** ![cmjones](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@cmjones](https://discourse.slicer.org/u/cmjones)\
**Post date:** [June 5, 2023, 12:59pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/7 "2023-06-05T12:59:52Z")

</div>

I still don’t seem to be able to upgrade PyTorch on 3D slicer. Could you help troubleshoot?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 5, 2023, 3:26pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/8 "2023-06-05T15:26:25Z")

</div>

I’ve submitted a pull request to make it easier to select pytorch version in PyTorch Utils module. Hopefully it will be merged today or tomorrow. You can track its status here:

> <https://github.com/fepegar/SlicerPyTorch/pull/11>
>
> The main motivation for this is that on some computers when installing PyTorch w…ith default options, a very old version (1.8.1) is installed. The new API and GUI allows specifying a requirement (e.g., "\>=1.12" or "\>=2").
> 
> While this does not address the question of why old version is installed by default, it allows modules to automatically install correct pytorch version and allows users to manually specify a version, if effectively fixes #9

You need to use the lateset Slicer Stable Release or latest Slicer Preview Release to get the update (the update is available automatically in the Extensions Manager the day after the pull request is merged).

---

<div class="post-metadata">

**Author:** ![cmjones](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@cmjones](https://discourse.slicer.org/u/cmjones)\
**Post date:** [June 5, 2023, 5:37pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/9 "2023-06-05T17:37:32Z")

</div>

Despite install PyTorch via Anaconda it still fails. When I then tried to run totalsegmentator it advised that I needed to install PyTorch which is then did however it installed version 1.8.1.

See screenshots.

 ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/6/66306567f36e5cad72f0e5a3431605c709823f3f.png) ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/0/20bb8c7d914530053005ce447fdd76fd11fa983f.png) ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/2/321df22ff5ec7169395cd114edfec523421dac5f.jpeg)

Here’s a copy of the console:

Collecting torch  
Using cached [https://download.pytorch.org/whl/cpu/torch-2.0.1-cp39-none-macosx\_10\_9\_x86\_64.whl](https://download.pytorch.org/whl/cpu/torch-2.0.1-cp39-none-macosx_10_9_x86_64.whl) (143.4 MB)  
Collecting torchvision  
Using cached [https://download.pytorch.org/whl/torchvision-0.9.1-cp39-cp39-macosx\_10\_9\_x86\_64.whl](https://download.pytorch.org/whl/torchvision-0.9.1-cp39-cp39-macosx_10_9_x86_64.whl) (13.1 MB)  
Collecting jinja2  
Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)  
Collecting filelock  
Using cached filelock-3.12.0-py3-none-any.whl (10 kB)  
Requirement already satisfied: typing-extensions in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torch) (4.6.0)  
Collecting sympy  
Using cached sympy-1.12-py3-none-any.whl (5.7 MB)  
Requirement already satisfied: networkx in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torch) (3.1)  
Collecting torch  
Using cached [https://download.pytorch.org/whl/cpu/torch-1.8.1-cp39-none-macosx\_10\_9\_x86\_64.whl](https://download.pytorch.org/whl/cpu/torch-1.8.1-cp39-none-macosx_10_9_x86_64.whl) (119.6 MB)  
Requirement already satisfied: pillow\>=4.1.1 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torchvision) (9.4.0)  
Requirement already satisfied: numpy in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torchvision) (1.23.4)  
Collecting MarkupSafe\>=2.0  
Using cached MarkupSafe-2.1.3-cp39-cp39-macosx\_10\_9\_x86\_64.whl (13 kB)  
Collecting mpmath\>=0.19  
Using cached mpmath-1.3.0-py3-none-any.whl (536 kB)  
Installing collected packages: torch, torchvision  
WARNING: The scripts convert-caffe2-to-onnx and convert-onnx-to-caffe2 are installed in ‘/Applications/Slicer.app/Contents/lib/Python/bin’ which is not on PATH.  
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.  
Successfully installed torch-1.8.1 torchvision-0.9.1

[notice] A new release of pip is available: 23.0 → 23.1.2  
[notice] To update, run: python-real -m pip install --upgrade pip  
[Python] Failed to compute results.  
[Python] Command ‘[’/Applications/Slicer.app/Contents/bin/…/bin/PythonSlicer’, ‘/Applications/Slicer.app/Contents/lib/Python/bin/TotalSegmentator’, ‘-i’, ‘/private/var/folders/n4/\_8hf03v543x\_q3b0k017wbfm0000gp/T/Slicer-mosc7cj2/\_\_SlicerTemp\_\_2023-06-05\_18+35+07.399/total-segmentator-input.nii’, ‘-o’, ‘/private/var/folders/n4/\_8hf03v543x\_q3b0k017wbfm0000gp/T/Slicer-mosc7cj2/\_\_SlicerTemp\_\_2023-06-05\_18+35+07.399/segmentation’, ‘–ml’, ‘–task’, ‘total’]’ returned non-zero exit status 120.  
Traceback (most recent call last):  
File “/Applications/Slicer.app/Contents/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 264, in onApplyButton  
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),  
File “/Applications/Slicer.app/Contents/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 762, in process  
self.logProcessOutput(proc)  
File “/Applications/Slicer.app/Contents/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 655, in logProcessOutput  
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)  
subprocess.CalledProcessError: Command ‘[’/Applications/Slicer.app/Contents/bin/…/bin/PythonSlicer’, ‘/Applications/Slicer.app/Contents/lib/Python/bin/TotalSegmentator’, ‘-i’, ‘/private/var/folders/n4/\_8hf03v543x\_q3b0k017wbfm0000gp/T/Slicer-mosc7cj2/\_\_SlicerTemp\_\_2023-06-05\_18+35+07.399/total-segmentator-input.nii’, ‘-o’, ‘/private/var/folders/n4/\_8hf03v543x\_q3b0k017wbfm0000gp/T/Slicer-mosc7cj2/\_\_SlicerTemp\_\_2023-06-05\_18+35+07.399/segmentation’, ‘–ml’, ‘–task’, ‘total’]’ returned non-zero exit status 120.

---

<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:** [June 5, 2023, 6:04pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/10 "2023-06-05T18:04:24Z")

</div>

It appears that for some reason `torchvision` 0.9.1 is getting installed which is compatible with `torch` 1.8. See chart at [GitHub - pytorch/vision: Datasets, Transforms and Models specific to Computer Vision](https://github.com/pytorch/vision/tree/main#installation).

I’m not sure why it is not getting the latest `torchvision`, but that does appear to explain why torch 1.8.x would get installed.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 5, 2023, 7:11pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/11 "2023-06-05T19:11:17Z")

</div>

> [@jamesobutler](#):
>
> I’m not sure why it is not getting the latest `torchvision`, but that does appear to explain why torch 1.8.x would get installed.

It’s interesting, maybe it is related to torchvision. Anyway, if the [pull request](https://github.com/fepegar/SlicerPyTorch/pull/11) gets merged (hopefully tomorrow) then it’ll be really easy to upgrade/downgrade pytorch.

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [June 5, 2023, 7:41pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/12 "2023-06-05T19:41:35Z")

</div>

Have you tried [this page with the various script installer](https://pytorch.org/get-started/locally/) options?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/9/09e2bf7a5e8784c58525eb9bb6ff62e2190f9c19.png)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 5, 2023, 7:47pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/13 "2023-06-05T19:47:36Z")

</div>

Yes, indeed, @cmjones if you don’t want to wait a day then you can run the command that you get from the official pytorch website that @rbumm showed above. You just need to use `PythonSlicer` instead of `pip3`.

---

<div class="post-metadata">

**Author:** ![cmjones](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@cmjones](https://discourse.slicer.org/u/cmjones)\
**Post date:** [June 5, 2023, 8:17pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/14 "2023-06-05T20:17:34Z")

</div>

I’ve installed PyTorch using Conda but when I try to import or install in Slicer it seems to only install version 1.8.1.

> > > import PyTorchUtils

> > > torch = PyTorchUtils.PyTorchUtilsLogic().torch

Collecting torch

Using cached [https://download.pytorch.org/whl/cpu/torch-2.0.1-cp39-none-macosx\_10\_9\_x86\_64.whl](https://download.pytorch.org/whl/cpu/torch-2.0.1-cp39-none-macosx_10_9_x86_64.whl) (143.4 MB)

Collecting torchvision

Using cached [https://download.pytorch.org/whl/torchvision-0.9.1-cp39-cp39-macosx\_10\_9\_x86\_64.whl](https://download.pytorch.org/whl/torchvision-0.9.1-cp39-cp39-macosx_10_9_x86_64.whl) (13.1 MB)

Collecting sympy

Using cached sympy-1.12-py3-none-any.whl (5.7 MB)

Collecting jinja2

Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)

Requirement already satisfied: networkx in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torch) (3.1)

Requirement already satisfied: typing-extensions in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torch) (4.6.3)

Collecting filelock

Using cached filelock-3.12.0-py3-none-any.whl (10 kB)

Requirement already satisfied: pillow\>=4.1.1 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torchvision) (9.4.0)

Requirement already satisfied: numpy in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torchvision) (1.24.2)

Collecting torch

Using cached [https://download.pytorch.org/whl/cpu/torch-1.8.1-cp39-none-macosx\_10\_9\_x86\_64.whl](https://download.pytorch.org/whl/cpu/torch-1.8.1-cp39-none-macosx_10_9_x86_64.whl) (119.6 MB)

Collecting MarkupSafe\>=2.0

Using cached MarkupSafe-2.1.3-cp39-cp39-macosx\_10\_9\_x86\_64.whl (13 kB)

Collecting mpmath\>=0.19

Using cached mpmath-1.3.0-py3-none-any.whl (536 kB)

Installing collected packages: torch, torchvision

WARNING: The scripts convert-caffe2-to-onnx and convert-onnx-to-caffe2 are installed in ‘/Applications/Slicer.app/Contents/lib/Python/bin’ which is not on PATH.

Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Successfully installed torch-1.8.1 torchvision-0.9.1

[notice] A new release of pip is available: 23.0.1 → 23.1.2

[notice] To update, run: python-real -m pip install --upgrade pip

---

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [June 5, 2023, 9:05pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/15 "2023-06-05T21:05:41Z")

</div>

`slicer.util.pip_install("-U torch torchvision")` in python console worked for me

---

<div class="post-metadata">

**Author:** ![cmjones](https://avatars.discourse-cdn.com/v4/letter/c/f17d59/32.png) [@cmjones](https://discourse.slicer.org/u/cmjones)\
**Post date:** [June 6, 2023, 5:34am UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/16 "2023-06-06T05:34:56Z")

</div>

> [@Alex\_Vergara](#):
>
> slicer.util.pip\_install(“-U torch torchvision”)

Thank you. I have finally managed to get it to work by running:

pip.main([‘install’, ‘–upgrade’, ‘torch’])  
pip.main([‘install’, ‘–upgrade’, ‘torchvision’])

and then install PyTorch via the Extensions Manager

Thank you for your help

---

<div class="post-metadata">

**Author:** ![pssi\_92](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pssi_92/32/66407_2.png) [@pssi\_92](https://discourse.slicer.org/u/pssi_92)\
**Post date:** [June 13, 2023, 5:24pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/17 "2023-06-13T17:24:45Z")

</div>

I have a Total segmentator running errors.  
My GPU is RTX 3070 (VRAM 8Gb). Cuda version 12.1. Slicer ver 5.2.2  
I have installed TotalSegmentator extension (ver. 9340dd7) and PyTorch (ver. fe2e92e) through Extension Manager.  
When I press Apply button of Total Segmentator with Fast option off, the Slicer 5.2.2 become frozen.  
With Fast option on, this error message appeared.  
What can I do to fix this issue?

Traceback (most recent call last):  
File “C:\Users\Anatomy-Kim\AppData\Local\NA-MIC\Slicer 5.2.2\bin\Python\slicer\util.py”, line 2967, in tryWithErrorDisplay  
yield  
File “C:/Users/Anatomy-Kim/AppData/Local/NA-MIC/Slicer 5.2.2/NA-MIC/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 264, in onApplyButton  
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),  
File “C:/Users/Anatomy-Kim/AppData/Local/NA-MIC/Slicer 5.2.2/NA-MIC/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 762, in process  
self.logProcessOutput(proc)  
File “C:/Users/Anatomy-Kim/AppData/Local/NA-MIC/Slicer 5.2.2/NA-MIC/Extensions-31382/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 655, in logProcessOutput  
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)  
subprocess.CalledProcessError: Command ‘[‘C:/Users/Anatomy-Kim/AppData/Local/NA-MIC/Slicer 5.2.2/bin/…/bin\PythonSlicer.EXE’, ‘C:\Users\Anatomy-Kim\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Scripts\TotalSegmentator’, ‘-i’, ‘C:/Users/Anatomy-Kim/AppData/Local/Temp/Slicer/\_\_SlicerTemp\_\_2023-06-13\_14+50+31.409/total-segmentator-input.nii’, ‘-o’, ‘C:/Users/Anatomy-Kim/AppData/Local/Temp/Slicer/\_\_SlicerTemp\_\_2023-06-13\_14+50+31.409/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]’ returned non-zero exit status 120.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 13, 2023, 5:31pm UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/18 "2023-06-13T17:31:31Z")

</div>

@pssi_92 You have `returned non-zero exit status 120` in the log, which means that the installed PyTorch version is not compatible with TotalSegmentator. You can uninstall the current version of Pytorch and install a compatible version using PyTorch Utils module:

- Go to `PyTorch Utils` module
- Click `Uninstall PyTorch`
- Restart Slicer
- Go to `PyTorch Utils` module
- Type `>=2` in `PyTorch version requirement` (this forces installation of PyTorch version \>=2.0.0, which is compatible with TotalSegmentator)
- Click `Install PyTorch`

---

<div class="post-metadata">

**Author:** ![pssi\_92](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pssi_92/32/66407_2.png) [@pssi\_92](https://discourse.slicer.org/u/pssi_92)\
**Post date:** [June 19, 2023, 2:40am UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/20 "2023-06-19T02:40:18Z")

</div>

Thank you for advice.  
In my computer today, the total segmentator worked fine. I don’t know what happened exactly.  
I installed total segmentator same in other computer of my colleague, but it won’t work well.  
The error message was same “returned non-zero exit status 120”.

So I followed your advice but the result was same.  
Before I reinstall PyTorch, I checked the version but it was 2.0.1+cu118.  
I think it is higher version than 2.0.0.

The GPU was GTX 1070, Cuda version 12.1, Slicer 5.2.2. PyTorch verison 2.0.1+cu118.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 19, 2023, 3:01am UTC](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600/21 "2023-06-19T03:01:58Z")

</div>

Maybe the installation on your colleague’s computer is corrupted (most likely due to insufficient disk space or network error during installation).

I would recommend to reinstall Slicer from scratch into an empty folder. Also remove the downloaded TotalSegmentator model from your user profile folder. When installing TotalSegmentator and its dependencies make sure to have at least 20GB of free disk space. If there is any error then

[Next page](https://discourse.slicer.org/t/totalsegmentator-error-failed-to-compute-result-returned-non-zero-exit-status-120/29600.md?page=2)
