Error while installing pytorch

Hello!

Thank you for your reply! This is what I am seeing in my Extensions Manager:

However, when I go into the PyTorch module, I am still seeing this:

I installed the SlicerNNUnet extension, and am still getting the "No module named torch” error.

My CPU is: Intel(R) Core ™ i5 - 10500 CPU @ 3.1 GHz

My GPU is: Intel(R) UHD Graphics 630 (0.7/7.9 GB used)

Free disk space: 273 GB

Is CUDA necessary?

Thank you so much!

What happens when you choose the CPU as the computation backend, and then click install PyTorch?

You don’t seem to have a NVIDIA gpu, so CUDA part is moot.

Also know that with CPU-only torch, NNInteractive and deep-learnign tools will work slow. The main speed up comes from fast GPUs (which you don’t seem to have in your system).

When I choose the CPU computation backend, then click install PyTorch, I get the “No module named ‘torch’” error.

Hello all!

Just following up about any other solutions. I still haven’t had any success with installing PyTorch or running Total Segmentator.

Thank you!

ThisCPU model was released 5 years ago and it wad not high-end even then, so it is expected that you run into difficulties when you want to use it for CPU-only inference. How much RAM do you have?

Your Python environment is quite messy by now, so I would recommend to remove the entire Slicer installation folder and install Slicee-5.8.1, install only PyTorch extension, and then use it to install a CPU-only pytorch. If you encounter any errors, copy here the content of the Python console and the Slicer application log (menu: Help / Report a bug).

Thank you for your reply! I have 16 GB of RAM.

After I redownloaded Slicer and installed CPU-only PyTorch, I still got the “No module named torch” error. Here is the application log:

[DEBUG][Qt] 08.08.2025 07:57:13 (unknown:0) - Session start time …: 20250808_075713
[DEBUG][Qt] 08.08.2025 07:57:13 (unknown:0) - Slicer version …: 5.8.1 (revision 33241 / 11eaf62) win-amd64 - installed release
[DEBUG][Qt] 08.08.2025 07:57:13 (unknown:0) - Operating system …: Windows / Professional / (Build 26100, Code Page 65001) - 64-bit
[DEBUG][Qt] 08.08.2025 07:57:13 (unknown:0) - Memory …: 16155 MB physical, 28352 MB virtual
[DEBUG][Qt] 08.08.2025 07:57:13 (unknown:0) - CPU …: GenuineIntel , 12 cores, 12 logical processors
[DEBUG][Qt] 08.08.2025 07:57:13 (unknown:0) - VTK configuration …: OpenGL2 rendering, TBB threading
[DEBUG][Qt] 08.08.2025 07:57:13 (unknown:0) - Qt configuration …: version 5.15.2, with SSL, requested OpenGL 3.2 (compatibility profile)
[DEBUG][Qt] 08.08.2025 07:57:13 (unknown:0) - DCMTK configuration …: version 3.6.8, no SSL
[DEBUG][Qt] 08.08.2025 07:57:13 (unknown:0) - Internationalization …: disabled, language=
[DEBUG][Qt] 08.08.2025 07:57:13 (unknown:0) - Developer mode …: disabled
[DEBUG][Qt] 08.08.2025 07:57:13 (unknown:0) - Application path …: C:/Users/O/AppData/Local/slicer.org/Slicer 5.8.1/bin
[DEBUG][Qt] 08.08.2025 07:57:13 (unknown:0) - Additional module paths ..: slicer.org/Extensions-33241/PyTorch/lib/Slicer-5.8/qt-scripted-modules
[DEBUG][Python] 08.08.2025 07:57:16 [Python] (C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Slicer-5.8\qt-scripted-modules\SubjectHierarchyPlugins\AbstractScriptedSubjectHierarchyPlugin.py:40) - Scripted subject hierarchy plugin registered: SegmentEditor
[DEBUG][Python] 08.08.2025 07:57:16 [Python] (C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Slicer-5.8\qt-scripted-modules\SubjectHierarchyPlugins\AbstractScriptedSubjectHierarchyPlugin.py:40) - Scripted subject hierarchy plugin registered: SegmentStatistics
[DEBUG][Qt] 08.08.2025 07:57:16 (unknown:0) - Switch to module: “Welcome”
[DEBUG][Qt] 08.08.2025 07:57:24 (unknown:0) - Switch to module: “PyTorchUtils”
[INFO][Python] 08.08.2025 07:57:49 [Python] (C:/Users/O/AppData/Local/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/PyTorch/lib/Slicer-5.8/qt-scripted-modules/PyTorchUtils.py:216) - Install PyTorch using light-the-torch with arguments: [‘install’, ‘torch’, ‘torchvision’, ‘–pytorch-computation-backend=cpu’]
[INFO][Stream] 08.08.2025 07:58:01 (unknown:0) - Collecting light-the-torch>=0.5
[INFO][Stream] 08.08.2025 07:58:01 (unknown:0) - Using cached light_the_torch-0.8.0-py3-none-any.whl.metadata (9.3 kB)
[INFO][Stream] 08.08.2025 07:58:01 (unknown:0) - Requirement already satisfied: pip<24.4,>=22.3 in c:\users\o\appdata\local\slicer.org\slicer 5.8.1\lib\python\lib\site-packages (from light-the-torch>=0.5) (24.0)
[INFO][Stream] 08.08.2025 07:58:01 (unknown:0) - Using cached light_the_torch-0.8.0-py3-none-any.whl (14 kB)
[INFO][Stream] 08.08.2025 07:58:01 (unknown:0) - Installing collected packages: light-the-torch
[INFO][Stream] 08.08.2025 07:58:02 (unknown:0) - Successfully installed light-the-torch-0.8.0
[DEBUG][Python] 08.08.2025 07:58:02 [Python] (C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\vcs\versioncontrol.py:225) - Registered VCS backend: bzr
[DEBUG][Python] 08.08.2025 07:58:02 [Python] (C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\vcs\versioncontrol.py:225) - Registered VCS backend: git
[DEBUG][Python] 08.08.2025 07:58:02 [Python] (C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\vcs\versioncontrol.py:225) - Registered VCS backend: hg
[DEBUG][Python] 08.08.2025 07:58:02 [Python] (C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\vcs\versioncontrol.py:225) - Registered VCS backend: svn
[INFO][Stream] 08.08.2025 07:58:04 (unknown:0) - WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)’))’: /whl/cpu/torch/
[INFO][Stream] 08.08.2025 07:58:04 (unknown:0) - WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)’))’: /whl/cpu/torch/
[INFO][Stream] 08.08.2025 07:58:06 (unknown:0) - WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)’))’: /whl/cpu/torch/
[INFO][Stream] 08.08.2025 07:58:09 (unknown:0) - WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)’))’: /whl/cpu/torch/
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)’))’: /whl/cpu/torch/
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - Could not fetch URL https://download.pytorch.org/whl/cpu/torch/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘download.pytorch.org’, port=443): Max retries exceeded with url: /whl/cpu/torch/ (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)’))) - skipping
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - ERROR: Exception:
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - Traceback (most recent call last):
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\cli\base_command.py”, line 180, in exc_logging_wrapper
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - status = run_func(*args)
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\cli\req_command.py”, line 245, in wrapper
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - return func(self, options, args)
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\commands\install.py”, line 377, in run
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - requirement_set = resolver.resolve(
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\light_the_torch_utils.py”, line 103, in new
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - output = fn(*args, **kwargs)
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\resolver.py”, line 95, in resolve
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - result = self._result = resolver.resolve(
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_vendor\resolvelib\resolvers.py”, line 546, in resolve
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - state = resolution.resolve(requirements, max_rounds=max_rounds)
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_vendor\resolvelib\resolvers.py”, line 397, in resolve
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - self._add_to_criteria(self.state.criteria, r, parent=None)
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_vendor\resolvelib\resolvers.py”, line 173, in _add_to_criteria
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - if not criterion.candidates:
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_vendor\resolvelib\structs.py”, line 156, in bool
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - return bool(self._sequence)
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py”, line 155, in bool
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - return any(self)
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py”, line 143, in
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - return (c for c in iterator if id(c) not in self._incompatible_ids)
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py”, line 44, in _iter_built
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - for version, func in infos:
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\resolution\resolvelib\factory.py”, line 297, in iter_index_candidate_infos
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - result = self._finder.find_best_candidate(
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\index\package_finder.py”, line 890, in find_best_candidate
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - candidates = self.find_all_candidates(project_name)
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\pip_internal\index\package_finder.py”, line 817, in find_all_candidates
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - collected_sources = self._link_collector.collect_sources(
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\light_the_torch_utils.py”, line 104, in new
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - return postprocessing(input, output)
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - File “C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\lib\Python\Lib\site-packages\light_the_torch_patch.py”, line 349, in postprocessing
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - _, pypi_file_source = build_source(
[INFO][Stream] 08.08.2025 07:58:13 (unknown:0) - TypeError: build_source() missing 1 required keyword-only argument: ‘project_name’
[ERROR][Python] 08.08.2025 07:58:13 [Python] (C:\Users\O\AppData\Local\slicer.org\Slicer 5.8.1\bin\Python\slicer\util.py:3057) - Failed to install PyTorch. Some PyTorch files may be in use or corrupted. Please restart the application, uninstall PyTorch, and try installing again.

No module named ‘torch’
[CRITICAL][Stream] 08.08.2025 07:58:33 (unknown:0) - Traceback (most recent call last):
[CRITICAL][Stream] 08.08.2025 07:58:33 (unknown:0) - File “C:/Users/O/AppData/Local/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/PyTorch/lib/Slicer-5.8/qt-scripted-modules/PyTorchUtils.py”, line 78, in onInstallTorch
[CRITICAL][Stream] 08.08.2025 07:58:33 (unknown:0) - torch = self.logic.installTorch(askConfirmation, None if automaticBackend else backend, torchVersionRequirement, torchvisionVersionRequirement)
[CRITICAL][Stream] 08.08.2025 07:58:33 (unknown:0) - File “C:/Users/O/AppData/Local/slicer.org/Slicer 5.8.1/slicer.org/Extensions-33241/PyTorch/lib/Slicer-5.8/qt-scripted-modules/PyTorchUtils.py”, line 225, in installTorch
[CRITICAL][Stream] 08.08.2025 07:58:33 (unknown:0) - import torch
[CRITICAL][Stream] 08.08.2025 07:58:33 (unknown:0) - ModuleNotFoundError: No module named ‘torch’

You have a long series of SSL errors meaning necessary packages is failing to download on this connection. This happens sometimes when institutions use their own unsigned certificates or have strict firewalls. If thats the case you will have to work with your IT department to resolve the case.

The easiest way to test this is to use a public network and see if things out.

Okay, thank you so much!