Pytorch extension installation

Hello, I’ve been using total segmentator in Slicer 5.2.2 for quite sometime. Because of hardware issues, I detete slicer. When I reinstall slicer 5.2.2 and try to run total segmentator,I receive the message “PyTorch 1.8.1 + cpu is not compatible with this module…”. Previously, I’ve been running total segmentator tool with CPU (which is Intel iris Xe graphics) as I do not have dedicated GPU. I need help to fix this problem. Thank you.

You can use the SlicerPyTorch extension and see if you can configure it to install the correct version.

Or you can generate a pytorch install command from here: Start Locally | PyTorch

For example setting it to use CPU the pip install command it gives is

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu

so you can achieve this in your slicer python environment by opening the slicer python console and doing the following:

slicer.util.pip_install("torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu")

Consider first doing

slicer.util.pip_uninstall("torch")

to remove the old version – idk if it does that automatically

1 Like

CPU version of PyTorch is fine, you just need more recent PyTorch version than 1.8.1 for current TotalSegmentator version.

I have installed PyTorch. However, the same problem persists.


Your screenshot and error message says you are using Slicer 5.2.1. Please try with 5.2.2 (latest stable) and report back.

I used slicer5.3,uninstall pytorch, reinstall pytorch as the error message said set version >=1.12

屏幕截图 2023-08-04 145235

Sir, I am using both 5.2.1 and 5.2.2 version. It did not work in both.