Error in PyTorch installation

I am installing Totalsegmentation in Windows 10, after the installation, I continued to install the PyTorch, and got the error:


I already uninstall, restart, reinstall, and restart, there is no difference.

My setup is:
I7-10700CPU@2.90GHz
64GB RAM
Windows 10 Pro
NIVIDIA GeForce RTX 3060 Ti, Driver version 560.94
NIVIDIA GeForce Experience Version 3.28.0.417
3D Slicer Version 5.6.2

The details of the error are as follows:
Traceback (most recent call last):

File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py”, line 219, in installTorch

import light_the_torch._patch

ModuleNotFoundError: No module named ‘light_the_torch’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3255, in tryWithErrorDisplay

yield

File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py”, line 78, in onInstallTorch

torch = self.logic.installTorch(askConfirmation, None if automaticBackend else backend, torchVersionRequirement, torchvisionVersionRequirement)

File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py”, line 221, in installTorch

PyTorchUtilsLogic._installLightTheTorch()

File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py”, line 247, in _installLightTheTorch

slicer.util.pip_install(‘light-the-torch>=0.5’)

File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3887, in pip_install

_executePythonModule(“pip”, args)

File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3848, in _executePythonModule

logProcessOutput(proc)

File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3814, in logProcessOutput

raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)

subprocess.CalledProcessError: Command ‘[‘C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/bin/…/bin\PythonSlicer.EXE’, ‘-m’, ‘pip’, ‘install’, ‘light-the-torch>=0.5’]’ returned non-zero exit status 1.

Please advise.
Thanks.

Please check the application log, Python console, or the textbox under the Apply button in the TotalSegmentator module. There should be some more specific information about why light-the-torch installation fails.

Thanks for the reply.
I got these:



The text copy is the following:

Traceback (most recent call last):
File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py”, line 219, in installTorch
import light_the_torch._patch
ModuleNotFoundError: No module named ‘light_the_torch’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py”, line 78, in onInstallTorch
torch = self.logic.installTorch(askConfirmation, None if automaticBackend else backend, torchVersionRequirement, torchvisionVersionRequirement)
File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py”, line 221, in installTorch
PyTorchUtilsLogic._installLightTheTorch()
File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py”, line 247, in _installLightTheTorch
slicer.util.pip_install(‘light-the-torch>=0.5’)
File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3887, in pip_install
_executePythonModule(“pip”, args)
File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3848, in _executePythonModule
logProcessOutput(proc)
File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3814, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command ‘[‘C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/bin/…/bin\PythonSlicer.EXE’, ‘-m’, ‘pip’, ‘install’, ‘light-the-torch>=0.5’]’ returned non-zero exit status 1.

Python Console:

error: Application does NOT exists [C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/bin/./python-real.exe]

Usage

PythonSlicer [options]

Options

–launcher-help Display help

–launcher-version Show launcher version information

–launcher-verbose Verbose mode

–launch Specify the application to launch

–launcher-detach Launcher will NOT wait for the application to finish

–launcher-no-splash Hide launcher splash

–launcher-timeout Specify the time in second before the launcher kills the application. -1 means no timeout (default: -1)

–launcher-load-environment Specify the saved environment to load.

–launcher-dump-environment Launcher will print environment variables to be set, then exit

–launcher-show-set-environment-commands Launcher will print commands suitable for setting the parent environment (i.e. using ‘eval’ in a POSIX shell), then exit

–launcher-additional-settings Additional settings file to consider

–launcher-additional-settings-exclude-groups Comma separated list of settings groups that should NOT be overwritten by values in User and Additional settings. For example: General,Application,ExtraApplicationToLaunch

–launcher-ignore-user-additional-settings Ignore additional user settings

–launcher-generate-exec-wrapper-script Generate executable wrapper script allowing to set the environment

–launcher-generate-template Generate an example of setting file

[Python] Failed to install PyTorch. Some PyTorch files may be in use or corrupted. Please restart the application, uninstall PyTorch, and try installing again.

[Python] Command ‘[‘C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/bin/…/bin\PythonSlicer.EXE’, ‘-m’, ‘pip’, ‘install’, ‘light-the-torch>=0.5’]’ returned non-zero exit status 1.

Traceback (most recent call last):

File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py”, line 219, in installTorch

import light_the_torch._patch

ModuleNotFoundError: No module named ‘light_the_torch’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py”, line 78, in onInstallTorch

torch = self.logic.installTorch(askConfirmation, None if automaticBackend else backend, torchVersionRequirement, torchvisionVersionRequirement)

File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py”, line 221, in installTorch

PyTorchUtilsLogic._installLightTheTorch()

File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/PyTorch/lib/Slicer-5.6/qt-scripted-modules/PyTorchUtils.py”, line 247, in _installLightTheTorch

slicer.util.pip_install(‘light-the-torch>=0.5’)

File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3887, in pip_install

_executePythonModule(“pip”, args)

File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3848, in _executePythonModule

logProcessOutput(proc)

File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3814, in logProcessOutput

raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)

subprocess.CalledProcessError: Command ‘[‘C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/bin/…/bin\PythonSlicer.EXE’, ‘-m’, ‘pip’, ‘install’, ‘light-the-torch>=0.5’]’ returned non-zero exit status 1.

[Qt] QWindowsWindow::setGeometry: Unable to set geometry 1420x745+0+23 (frame: 1436x784-8-8) on QWidgetWindow/“qSlicerMainWindowWindow” on “\.\DISPLAY1”. Resulting geometry: 1366x745+0+23 (frame: 1382x784-8-8) margins: 8, 31, 8, 8 minimum size: 1420x418 MINMAXINFO maxSize=0,0 maxpos=0,0 mintrack=1436,457 maxtrack=0,0)

[Qt] QWindowsWindow::setGeometry: Unable to set geometry 1420x745+0+23 (frame: 1436x784-8-8) on QWidgetWindow/“qSlicerMainWindowWindow” on “\.\DISPLAY1”. Resulting geometry: 1366x745+0+23 (frame: 1382x784-8-8) margins: 8, 31, 8, 8 minimum size: 1420x446 MINMAXINFO maxSize=0,0 maxpos=0,0 mintrack=1436,485 maxtrack=0,0)

[Qt] QWindowsWindow::setGeometry: Unable to set geometry 1444x745+0+23 (frame: 1460x784-8-8) on QWidgetWindow/“qSlicerMainWindowWindow” on “\.\DISPLAY1”. Resulting geometry: 1366x745+0+23 (frame: 1382x784-8-8) margins: 8, 31, 8, 8 minimum size: 1444x418 MINMAXINFO maxSize=0,0 maxpos=0,0 mintrack=1460,457 maxtrack=0,0)

error: Application does NOT exists [C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/bin/./python-real.exe]

Usage

PythonSlicer [options]

Options

–launcher-help Display help

–launcher-version Show launcher version information

–launcher-verbose Verbose mode

Cont…

–launch Specify the application to launch

–launcher-detach Launcher will NOT wait for the application to finish

–launcher-no-splash Hide launcher splash

–launcher-timeout Specify the time in second before the launcher kills the application. -1 means no timeout (default: -1)

–launcher-load-environment Specify the saved environment to load.

–launcher-dump-environment Launcher will print environment variables to be set, then exit

–launcher-show-set-environment-commands Launcher will print commands suitable for setting the parent environment (i.e. using ‘eval’ in a POSIX shell), then exit

–launcher-additional-settings Additional settings file to consider

–launcher-additional-settings-exclude-groups Comma separated list of settings groups that should NOT be overwritten by values in User and Additional settings. For example: General,Application,ExtraApplicationToLaunch

–launcher-ignore-user-additional-settings Ignore additional user settings

–launcher-generate-exec-wrapper-script Generate executable wrapper script allowing to set the environment

–launcher-generate-template Generate an example of setting file

Traceback (most recent call last):

File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py”, line 717, in setupPythonRequirements

import pandas

ModuleNotFoundError: No module named ‘pandas’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py”, line 274, in onApplyButton

self.logic.setupPythonRequirements()

File “C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/slicer.org/Extensions-32448/TotalSegmentator/lib/Slicer-5.6/qt-scripted-modules/TotalSegmentator.py”, line 719, in setupPythonRequirements

slicer.util.pip_install(“pandas”)

File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3887, in pip_install

_executePythonModule(“pip”, args)

File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3848, in _executePythonModule

logProcessOutput(proc)

File “C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\Python\slicer\util.py”, line 3814, in logProcessOutput

raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)

subprocess.CalledProcessError: Command ‘[‘C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/bin/…/bin\PythonSlicer.EXE’, ‘-m’, ‘pip’, ‘install’, ‘pandas’]’ returned non-zero exit status 1.

[Python] Failed to install required packages.

[Python] Command ‘[‘C:/Users/User/AppData/Local/slicer.org/Slicer 5.6.2/bin/…/bin\PythonSlicer.EXE’, ‘-m’, ‘pip’, ‘install’, ‘pandas’]’ returned non-zero exit status 1.

[Qt] Mixed Content: The page at ‘@KitwareMedical/slicer-extensions-webapp’ was loaded over HTTPS, but requested an insecure image ‘http://wiki.slicer.org/slicerWiki/images/2/2a/CarreraSliceEffect.png’. This content should also be served over HTTPS.

This is an important message.

Does this file exist on your computer?

C:\Users\User\AppData\Local\slicer.org\Slicer 5.6.2\bin\python-real.exe

(I guess you need to replace User by your actual username)

Does your username contain special (non-ASCII) characters?

1 Like

Or has Windows Defender or other antivirus incorrectly quarantined python-real.exe making it no longer exist at that location?

1 Like

Yes, thanks. I have Norton, it probably blocked some actions in the installation.
I can find the file in the folder.

I reinstalled Slicer 5.6.2, and PyTorch, giving it an exception for Norton’s blocking action
Can install PyTorch version 1.81
Uninstalled 1.81 and reinstall with “>1.12” in the version requirement
Again give an exception for Norton’s blocking action
Then I received the following error: