Error while installing pytorch

Hii,
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\util.py”, line 2961, in tryWithErrorDisplay
yield
File “E:/apps/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, line 248, in onApplyButton
self.logic.setupPythonRequirements()
File “E:/apps/Slicer 5.2.1/NA-MIC/Extensions-31317/TotalSegmentator/lib/Slicer-5.2/qt-scripted-modules/TotalSegmentator.py”, 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/PyTorchUtils.py”, 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

image

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+https://github.com/wasserth/TotalSegmentator.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.

3 Likes

Thank you, reinstalling pytorch worked :slight_smile:

1 Like

Very useful. Thank you