# Version 5.10.0, error in total segmentator

**URL:** <https://discourse.slicer.org/t/version-5-10-0-error-in-total-segmentator/45200>\
**Category:** Support\
**Created:** [November 23, 2025, 10:33pm UTC](https://discourse.slicer.org/t/version-5-10-0-error-in-total-segmentator/45200 "2025-11-23T22:33:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hepato](https://avatars.discourse-cdn.com/v4/letter/h/3da27b/32.png) [@hepato](https://discourse.slicer.org/u/hepato)\
**Post date:** [November 23, 2025, 10:33pm UTC](https://discourse.slicer.org/t/version-5-10-0-error-in-total-segmentator/45200/1 "2025-11-23T22:33:29Z")

</div>

processing started

Writing input file to /private/var/folders/0c/gpzkc1r575xdc6jdzv6v\_s6h0000gn/T/Slicer-cy/\_\_SlicerTemp\_\_2025-11-24\_06+19+55.287/total-segmentator-input.nii

Creating segmentations with TotalSegmentator AI…

Total Segmentator arguments: [‘-i’, ‘/private/var/folders/0c/gpzkc1r575xdc6jdzv6v\_s6h0000gn/T/Slicer-cy/\_\_SlicerTemp\_\_2025-11-24\_06+19+55.287/total-segmentator-input.nii’, ‘-o’, ‘/private/var/folders/0c/gpzkc1r575xdc6jdzv6v\_s6h0000gn/T/Slicer-cy/\_\_SlicerTemp\_\_2025-11-24\_06+19+55.287/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]

No GPU detected. Running on CPU. This can be very slow. The ‘–fast’ or the `–roi_subset` option can help to reduce runtime.

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)

Traceback (most recent call last):

File “/Applications/Slicer.app/Contents/lib/Python/bin/TotalSegmentator”, line 8, in

```auto
sys.exit(main())

         ^^^^^^

```

File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.12/site-packages/totalsegmentator/bin/TotalSegmentator.py”, line 155, in main

```auto
totalsegmentator(args.input, args.output, args.ml, args.nr_thr_resamp, args.nr_thr_saving,

```

File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.12/site-packages/totalsegmentator/python\_api.py”, line 142, in totalsegmentator

```auto
from totalsegmentator.nnunet import nnUNet_predict_image # this has to be after setting new env vars

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

```

File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.12/site-packages/totalsegmentator/nnunet.py”, line 29, in

```auto
from totalsegmentator.custom_trainers import nnUNetTrainer_MOSAIC_1k_QuarterLR_NoMirroring

```

File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.12/site-packages/totalsegmentator/custom\_trainers.py”, line 2, in

```auto
from nnunetv2.training.nnUNetTrainer.variants.data_augmentation.nnUNetTrainerNoMirroring import nnUNetTrainerNoMirroring

```

File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.12/site-packages/nnunetv2/training/nnUNetTrainer/variants/data\_augmentation/nnUNetTrainerNoMirroring.py”, line 26, in

```auto
from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer

```

File “/Applications/Slicer.app/Contents/lib/Python/lib/python3.12/site-packages/nnunetv2/training/nnUNetTrainer/nnUNetTrainer.py”, line 43, in

```auto
from torch import GradScaler

```

ImportError: cannot import name ‘GradScaler’ from ‘torch’ (/Applications/Slicer.app/Contents/lib/Python/lib/python3.12/site-packages/torch/\__init_\_.py)

Traceback (most recent call last):

File “/Applications/Slicer.app/Contents/bin/Python/slicer/util.py”, line 3392, in tryWithErrorDisplay

```auto
yield

```

File “/Applications/Slicer.app/Contents/Extensions-34045/TotalSegmentator/lib/Slicer-5.10/qt-scripted-modules/TotalSegmentator.py”, line 309, in onApplyButton

```auto
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputSegmentationSelector.currentNode(),

```

File “/Applications/Slicer.app/Contents/Extensions-34045/TotalSegmentator/lib/Slicer-5.10/qt-scripted-modules/TotalSegmentator.py”, line 1054, in process

```auto
self.processVolume(inputFile, inputVolume,

```

File “/Applications/Slicer.app/Contents/Extensions-34045/TotalSegmentator/lib/Slicer-5.10/qt-scripted-modules/TotalSegmentator.py”, line 1121, in processVolume

```auto
self.logProcessOutput(proc)

```

File “/Applications/Slicer.app/Contents/Extensions-34045/TotalSegmentator/lib/Slicer-5.10/qt-scripted-modules/TotalSegmentator.py”, line 900, in logProcessOutput

```auto
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/0c/gpzkc1r575xdc6jdzv6v\_s6h0000gn/T/Slicer-cy/\_\_SlicerTemp\_\_2025-11-24\_06+19+55.287/total-segmentator-input.nii’, ‘-o’, ‘/private/var/folders/0c/gpzkc1r575xdc6jdzv6v\_s6h0000gn/T/Slicer-cy/\_\_SlicerTemp\_\_2025-11-24\_06+19+55.287/segmentation’, ‘–ml’, ‘–task’, ‘total’, ‘–fast’]’ returned non-zero exit status 1.

---

<div class="post-metadata">

**Author:** ![hepato](https://avatars.discourse-cdn.com/v4/letter/h/3da27b/32.png) [@hepato](https://discourse.slicer.org/u/hepato)\
**Post date:** [November 23, 2025, 10:35pm UTC](https://discourse.slicer.org/t/version-5-10-0-error-in-total-segmentator/45200/2 "2025-11-23T22:35:31Z")

</div>

> [@hepato](#):
>
> ImportError: cannot import name ‘GradScaler’ from ‘torch’

ImportError: cannot import name ‘GradScaler’ from ‘torch’

---

<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:** [November 24, 2025, 12:02am UTC](https://discourse.slicer.org/t/version-5-10-0-error-in-total-segmentator/45200/3 "2025-11-24T00:02:14Z")

</div>

This appears to be an issue introduced by NNunetv2 developers. This package is a dependency of TotalSegmentator.

A possible workaround is to open the NNunet Slicer module which is used for installing versions of the package. Choose to install nnunetv2\<2.6 as it seems like the nnunetv2 2.6.0 version introduced this error that requires torch 2.6.0 and later for the CPU version of GradScaler.

Unfortunately, on macOS Slicer factory builds are still x86\_64 builds with no native arm64 build. The latest version of torch supported on x86\_64 macOS is torch 2.2.x. Slicer developers have been actively working to update a whole list of dependencies to be able to support native arm64 builds. Things are still in progress, but hopefully these type of issues on macOS will be resolved soon for users of macOS on Apple Silicon M based Macs.

> <https://github.com/Slicer/Slicer/issues/6811>
>
> This is meta issues aiming to organize the sub-tasks associated with arm64 suppo…rt. See Sub-issues listed below.
> 
> 
> Related issues and pull requests:
> \* https://github.com/Slicer/Slicer/issues/5944
> \* https://github.com/Slicer/Slicer/issues/6705
> \* https://github.com/Slicer/Slicer/issues/6490
> \* https://github.com/Slicer/Slicer/pull/8097
> 
> Related discourse posts:
> \* https://discourse.slicer.org/t/issues-running-slicer-on-macbook-m1-max/23974/3
> \* https://discourse.slicer.org/t/slicer-quit-unexpectedly-on-macbook-with-m1-chip/25989
> \* https://discourse.slicer.org/t/build-arm-32-openssl/31204
> \* https://discourse.slicer.org/t/developing-for-slicer-on-apple-silicon-build-targeting-x86-64/40686

---

<div class="post-metadata">

**Author:** ![hepato](https://avatars.discourse-cdn.com/v4/letter/h/3da27b/32.png) [@hepato](https://discourse.slicer.org/u/hepato)\
**Post date:** [November 24, 2025, 11:16am UTC](https://discourse.slicer.org/t/version-5-10-0-error-in-total-segmentator/45200/4 "2025-11-24T11:16:33Z")

</div>

Thanks for your reply. I reinstall slicer of version 5.8.1 again and problems resolved.
