# Error in PyTorch installation

**URL:** <https://discourse.slicer.org/t/error-in-pytorch-installation/39880>\
**Category:** Support\
**Created:** [October 27, 2024, 11:37am UTC](https://discourse.slicer.org/t/error-in-pytorch-installation/39880 "2024-10-27T11:37:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ben/32/78311_2.png) [@Ben](https://discourse.slicer.org/u/Ben)\
**Post date:** [October 27, 2024, 11:37am UTC](https://discourse.slicer.org/t/error-in-pytorch-installation/39880/1 "2024-10-27T11:37:28Z")

</div>

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

 ![2024-10-27_151523](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/e/fe5803a076f8d4679ea5d76cad1a89f0c9d2fed0.jpeg)  
I already uninstall, restart, reinstall, and restart, there is no difference.

My setup is:  
[I7-10700CPU@2.90GHz](mailto: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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 27, 2024, 11:41am UTC](https://discourse.slicer.org/t/error-in-pytorch-installation/39880/2 "2024-10-27T11:41:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ben](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ben/32/78311_2.png) [@Ben](https://discourse.slicer.org/u/Ben)\
**Post date:** [October 27, 2024, 3:15pm UTC](https://discourse.slicer.org/t/error-in-pytorch-installation/39880/3 "2024-10-27T15:15:05Z")

</div>

Thanks for the reply.  
I got these:

 ![2024-10-27_231231](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/3/e3fc06c56972cf9c397f3ddeb181d6a4b816f609.jpeg)  
 ![2024-10-27_231211](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/0/90788a1ac877d111c1bb3bc08068a432f8891ca1.jpeg)

---

<div class="post-metadata">

**Author:** ![Ben](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ben/32/78311_2.png) [@Ben](https://discourse.slicer.org/u/Ben)\
**Post date:** [October 27, 2024, 3:21pm UTC](https://discourse.slicer.org/t/error-in-pytorch-installation/39880/4 "2024-10-27T15:21:22Z")

</div>

![2024-10-27_232025](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/6/361e2d022da568bbc5a6ee74bfa01059f7692680.jpeg)  
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.

---

<div class="post-metadata">

**Author:** ![Ben](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ben/32/78311_2.png) [@Ben](https://discourse.slicer.org/u/Ben)\
**Post date:** [October 27, 2024, 3:29pm UTC](https://discourse.slicer.org/t/error-in-pytorch-installation/39880/5 "2024-10-27T15:29:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ben](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ben/32/78311_2.png) [@Ben](https://discourse.slicer.org/u/Ben)\
**Post date:** [October 27, 2024, 3:32pm UTC](https://discourse.slicer.org/t/error-in-pytorch-installation/39880/6 "2024-10-27T15:32:21Z")

</div>

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](https://extensions.slicer.org/catalog/All/32448/win)’ was loaded over HTTPS, but requested an insecure image ‘[http://wiki.slicer.org/slicerWiki/images/2/2a/CarreraSliceEffect.png](http://wiki.slicer.org/slicerWiki/images/2/2a/CarreraSliceEffect.png)’. This content should also be served over HTTPS.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 27, 2024, 4:59pm UTC](https://discourse.slicer.org/t/error-in-pytorch-installation/39880/7 "2024-10-27T16:59:13Z")

</div>

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

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?**

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [October 27, 2024, 5:00pm UTC](https://discourse.slicer.org/t/error-in-pytorch-installation/39880/8 "2024-10-27T17:00:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ben](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ben/32/78311_2.png) [@Ben](https://discourse.slicer.org/u/Ben)\
**Post date:** [October 27, 2024, 11:26pm UTC](https://discourse.slicer.org/t/error-in-pytorch-installation/39880/9 "2024-10-27T23:26:33Z")

</div>

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:

 ![2024-10-28_071534](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/7/4746d9d8ec240927700cc68346a9ac02c7f68934.jpeg)  
 ![2024-10-28_071601](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/1/d1110f2b999ce32b1daf7c2f976df19fe2b029e3.jpeg)

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [December 18, 2024, 3:47pm UTC](https://discourse.slicer.org/t/error-in-pytorch-installation/39880/10 "2024-12-18T15:47:07Z")

</div>

@Ben, in the screenshots that you provided you are putting the version requirement in the field specifically for `torchvision`, but if you are wanting to install the `torch` package, please place the “\>=1.12” into the “Torch version requirement” field and try again.
