Error while installing pytorch

I am having trouble applying the module in slicer 5.2.1. When i press apply, it says pytorch will be installed using light-the-torch. After few seconds, i get the error: failed to compute results, no module named torch.
Detailed error:
Traceback (most recent call last):
File “E:\apps\Slicer 5.2.1\bin\Python\slicer\”, line 2961, in tryWithErrorDisplay
File “E:/apps/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/”, line 248, in onApplyButton
File “E:/apps/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/”, line 494, in setupPythonRequirements
torch = torchLogic.installTorch(askConfirmation=True)
File “E:/apps/Slicer 5.2.1/NA-MIC/Extensions-31317/PyTorch/lib/Slicer-5.2/qt-scripted-modules/”, line 188, in installTorch
import torch
ModuleNotFoundError: No module named ‘torch’

Please let me know what am i doing wrong.

1 Like

Could you please install the PyTorch extension


and restart Slicer ?

Thanks, but it is already installed and doesn’t make a difference :confused:

If you are on Windows, could you please try to install TotalSegmentator from the command line (cmd.exe):

"C:\Users\yourname\AppData\Local\NA-MIC\Slicer 5.2.1\bin/PythonSlicer.EXE" -m pip install git+ --no-deps

and post the results?

I’ve made improvements to the PyTorch extension. Please update it using the Extensions Manager. You can then open PyTorch Utils module and first click Uninstall pytorch to remove any incomplete installs and then click Install pytorch to properly install it.


Thank you, reinstalling pytorch worked :slight_smile:

1 Like

Very useful. Thank you