# How to solve Pytorch version error in TotalSegmentator using CPU

**URL:** <https://discourse.slicer.org/t/how-to-solve-pytorch-version-error-in-totalsegmentator-using-cpu/34995>\
**Category:** Support\
**Tags:** totalsegmentator\
**Created:** [March 20, 2024, 7:45pm UTC](https://discourse.slicer.org/t/how-to-solve-pytorch-version-error-in-totalsegmentator-using-cpu/34995 "2024-03-20T19:45:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cchloe\_G](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cchloe_g/32/69702_2.png) [@Cchloe\_G](https://discourse.slicer.org/u/Cchloe_G)\
**Post date:** [March 20, 2024, 7:45pm UTC](https://discourse.slicer.org/t/how-to-solve-pytorch-version-error-in-totalsegmentator-using-cpu/34995/1 "2024-03-20T19:45:47Z")

</div>

My GPU is small, so I decided to use CPU to run totalsegmentator. I have uninstalled GPU version Pytorch in PyTorch Utils and downloaded cpu version Pytorch 1.8.1 successfully. However when I apply total segmentator, It shows this error:  
PyTorch version 1.8.1+cpu is not compatible with this module. Minimum required version is 1.12. You can use “PyTorch Util” module to install PyTorch with version requirement set to: \>=1.12

Please help me!

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [March 20, 2024, 9:28pm UTC](https://discourse.slicer.org/t/how-to-solve-pytorch-version-error-in-totalsegmentator-using-cpu/34995/2 "2024-03-20T21:28:47Z")

</div>

> [@Cchloe\_G](#):
>
> PyTorch Utils and downloaded cpu version Pytorch 1.8.1

Pyutil should display a number of different versions compatible with your system. You chose 1.8.1 because 1.12 (or higher) wasn’t available?

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [March 20, 2024, 9:40pm UTC](https://discourse.slicer.org/t/how-to-solve-pytorch-version-error-in-totalsegmentator-using-cpu/34995/3 "2024-03-20T21:40:30Z")

</div>

Himm this is interesting. I just tried on my Mac, and while it started downloading v 2.2.1, it ended up installing 1.8. Not sure why. @lassoan

```auto
Install PyTorch using light-the-torch with arguments: ['install', 'torch', 'torchvision', '--pytorch-computation-backend=cpu']
Collecting torch
  Downloading https://download.pytorch.org/whl/cpu/torch-2.2.1-cp39-none-macosx_10_9_x86_64.whl (151.0 MB)

Collecting torchvision
  Using cached https://download.pytorch.org/whl/torchvision-0.9.1-cp39-cp39-macosx_10_9_x86_64.whl (13.1 MB)
Requirement already satisfied: filelock in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torch) (3.13.1)
Requirement already satisfied: typing-extensions>=4.8.0 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torch) (4.8.0)
Requirement already satisfied: sympy in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torch) (1.12)
Requirement already satisfied: networkx in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torch) (3.2.1)
Requirement already satisfied: jinja2 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torch) (3.1.3)
Requirement already satisfied: fsspec in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torch) (2024.2.0)
Requirement already satisfied: numpy in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from torchvision) (1.26.1)
Collecting torch
  Using cached 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) (10.1.0)
Requirement already satisfied: MarkupSafe>=2.0 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from jinja2->torch) (2.1.5)
Requirement already satisfied: mpmath>=0.19 in /Applications/Slicer.app/Contents/lib/Python/lib/python3.9/site-packages (from sympy->torch) (1.3.0)
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

```

---

<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:** [March 22, 2024, 10:42pm UTC](https://discourse.slicer.org/t/how-to-solve-pytorch-version-error-in-totalsegmentator-using-cpu/34995/4 "2024-03-22T22:42:39Z")

</div>

Maybe PyTorch-1.8.1 files were in use and could not be updated. Try uninstalling pytorch, restart Slicer, and then install it. Maybe check if the `lib\Python\Lib\site-packages\torch` folder in the Slicer install tree is empty.

@muratmaga FYI, a [new Slicer extension](https://github.com/KitwareMedical/SlicerNNUnet) is in the works that all extensions that use nnunet could use to install nnunet and all its dependencies (and it should include all the tricks we learned from TotalSegmentator). You may consider using it for MEMOS.

---

<div class="post-metadata">

**Author:** ![So-lets-code](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/so-lets-code/32/79413_2.png) [@So-lets-code](https://discourse.slicer.org/u/So-lets-code)\
**Post date:** [February 10, 2025, 11:12pm UTC](https://discourse.slicer.org/t/how-to-solve-pytorch-version-error-in-totalsegmentator-using-cpu/34995/5 "2025-02-10T23:12:17Z")

</div>

I also have a Mac which installed v1.8.1 again and again. It eventually worked, you just need to **restart 3D slicer** after you uninstall 1.8.1. Once you reopen slicer and set Torch version to \>=1.12, it will automatically download v2.2.1

---

<div class="post-metadata">

**Author:** ![Sundeep\_Kisku](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sundeep_kisku/32/79161_2.png) [@Sundeep\_Kisku](https://discourse.slicer.org/u/Sundeep_Kisku)\
**Post date:** [March 4, 2025, 12:55pm UTC](https://discourse.slicer.org/t/how-to-solve-pytorch-version-error-in-totalsegmentator-using-cpu/34995/7 "2025-03-04T12:55:34Z")

</div>

Yes, doing this worked for my Mac too
