How to solve Pytorch version error in TotalSegmentator using CPU

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!

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?

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

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

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 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.