PyTorch utils bringing a very old version of torchvision
We want to use SAM for a module, which requires torchvision that is newer than what is brought by PyTorchUtils is installing. Based on torchvision release history, the version automatically installed (0.2.0) is almost a decade old. https://pypi.org/project/torchvision/#history
I am testing with the latest 5.8 stable on Linux
This is indeed unexpected.
I just tried on Windows (5.8 stable) and got this output:
Collecting light-the-torch>=0.5
Using cached light_the_torch-0.8.0-py3-none-any.whl.metadata (9.3 kB)
Requirement already satisfied: pip<24.4,>=22.3 in c:\users\fperezgarcia\appdata\local\slicer.org\slicer 5.8.0\lib\python\lib\site-packages (from light-the-torch>=0.5) (24.0)
Using cached light_the_torch-0.8.0-py3-none-any.whl (14 kB)
Installing collected packages: light-the-torch
Successfully installed light-the-torch-0.8.0
Collecting torch
Using cached https://download.pytorch.org/whl/cpu/torch-2.5.1%2Bcpu-cp39-cp39-win_amd64.whl (205.4 MB)
Collecting torchvision
Using cached https://download.pytorch.org/whl/cpu/torchvision-0.9.1%2Bcpu-cp39-cp39-win_amd64.whl (845 kB)
Collecting filelock (from torch)
Using cached https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl (11 kB)
Requirement already satisfied: typing-extensions>=4.8.0 in c:\users\fperezgarcia\appdata\local\slicer.org\slicer 5.8.0\lib\python\lib\site-packages (from torch) (4.12.1)
Collecting networkx (from torch)
Using cached https://download.pytorch.org/whl/networkx-3.2.1-py3-none-any.whl (1.6 MB)
Collecting jinja2 (from torch)
Using cached jinja2-3.1.5-py3-none-any.whl.metadata (2.6 kB)
Collecting fsspec (from torch)
Using cached https://download.pytorch.org/whl/fsspec-2024.2.0-py3-none-any.whl (170 kB)
Collecting sympy==1.13.1 (from torch)
Using cached https://download.pytorch.org/whl/sympy-1.13.1-py3-none-any.whl (6.2 MB)
Collecting mpmath<1.4,>=1.1.0 (from sympy==1.13.1->torch)
Using cached https://download.pytorch.org/whl/mpmath-1.3.0-py3-none-any.whl (536 kB)
Requirement already satisfied: numpy in c:\users\fperezgarcia\appdata\local\slicer.org\slicer 5.8.0\lib\python\lib\site-packages (from torchvision) (1.26.4)
Collecting torch
Using cached https://download.pytorch.org/whl/cpu/torch-1.8.1%2Bcpu-cp39-cp39-win_amd64.whl (190.4 MB)
Requirement already satisfied: pillow>=4.1.1 in c:\users\fperezgarcia\appdata\local\slicer.org\slicer 5.8.0\lib\python\lib\site-packages (from torchvision) (10.3.0)
Collecting MarkupSafe>=2.0 (from jinja2->torch)
Using cached MarkupSafe-3.0.2-cp39-cp39-win_amd64.whl.metadata (4.1 kB)
Installing collected packages: torch, torchvision
Successfully installed torch-1.8.1+cpu torchvision-0.9.1+cpu
So for some reason a recent version is collected first, and an old one afterwards.
I can't reproduce outside of Slicer:
$uv init --python 3.9 ltt
$ uv add light-the-torch
$ uv run ltt install torch
Collecting torch
Downloading https://download.pytorch.org/whl/cpu/torch-2.5.1%2Bcpu-cp39-cp39-linux_x86_64.whl (174.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 174.7/174.7 MB 33.1 MB/s eta 0:00:00
Collecting filelock (from torch)
Downloading https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl (11 kB)
Collecting typing-extensions>=4.8.0 (from torch)
Downloading https://download.pytorch.org/whl/typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Collecting networkx (from torch)
Downloading https://download.pytorch.org/whl/networkx-3.2.1-py3-none-any.whl (1.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 27.4 MB/s eta 0:00:00
Collecting jinja2 (from torch)
Downloading jinja2-3.1.5-py3-none-any.whl.metadata (2.6 kB)
Collecting fsspec (from torch)
Downloading https://download.pytorch.org/whl/fsspec-2024.2.0-py3-none-any.whl (170 kB)
Collecting sympy==1.13.1 (from torch)
Downloading https://download.pytorch.org/whl/sympy-1.13.1-py3-none-any.whl (6.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.2/6.2 MB 30.7 MB/s eta 0:00:00
Collecting mpmath<1.4,>=1.1.0 (from sympy==1.13.1->torch)
Downloading https://download.pytorch.org/whl/mpmath-1.3.0-py3-none-any.whl (536 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 kB 9.3 MB/s eta 0:00:00
Collecting MarkupSafe>=2.0 (from jinja2->torch)
Downloading MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.0 kB)
Downloading jinja2-3.1.5-py3-none-any.whl (134 kB)
Downloading MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20 kB)
Installing collected packages: mpmath, typing-extensions, sympy, networkx, MarkupSafe, fsspec, filelock, jinja2, torch
Successfully installed MarkupSafe-3.0.2 filelock-3.13.1 fsspec-2024.2.0 jinja2-3.1.5 mpmath-1.3.0 networkx-3.2.1 sympy-1.13.1 torch-2.5.1+cpu typing-extensions-4.9.0
$ uv pip freeze
filelock==3.13.1
fsspec==2024.2.0
jinja2==3.1.5
light-the-torch==0.8.0
markupsafe==3.0.2
mpmath==1.3.0
networkx==3.2.1
pip==24.3.1
sympy==1.13.1
torch==2.5.1+cpu
typing-extensions==4.9.0
Update: I can reproduce by installing both torch and torchvision. I've opened an issue at
- https://github.com/pmeier/light-the-torch/issues/157
torchvision==0.2.0 is the last version of torchvision that was pure Python and thus installable on any system. Whenever you see this, this is an indication whatever platform you are on, is not supported by the compiled versions. https://github.com/fepegar/SlicerPyTorch/issues/18#issue-2812580326 only speaks of Linux. Which architecture? x86 or arm or something else entirely?
It appears you are suffering from an issue of pip cache.
Referring to https://github.com/pytorch/vision?tab=readme-ov-file#installation there appears to be a tight coupling of which version of torchvision goes with a specific version of torch. In @fepegar's situation it uses the cached torch to install first which is version 2.5.1, and then it goes to install torchvision using the cached 0.9.1 whl. The version of torchvision is compatible with torch 0.8.x so that is why it ultimately gets downgraded.
If you are using Windows and clear out your pip cache location such as %LOCALAPPDATA%\pip\cache then I would expect it would be successful since it would pull latest torch (2.5.1) and latest torchvision (0.20) which happen to be compatible.
For reference in the torch community: https://discuss.pytorch.org/t/pytorch-keep-installing-wrong-version/169645
Would using --no-cache-dir in this extension help avoid this issue?
torchvision==0.2.0is the last version of torchvision that was pure Python and thus installable on any system. Whenever you see this, this is an indication whatever platform you are on, is not supported by the compiled versions. #18 (comment) only speaks of Linux. Which architecture? x86 or arm or something else entirely?
So there are couple different things going on. This particular Ubuntu system provides Nvidia 535.138 driver version, which supports cuda 12.2. Cuda 12.2 is not listed in Pytorch's support matrix (it lists 11.8, 12.1, 12.4). So while it is not technically suitable, the extension installs 2.51 with cuda 12.4 (as shown in the screenshot above). I am still not sure why it is bringing such an old version of torchvision.
If we change the computation backend from automatic and cu118, correct versions of all libraries is installed (see the screenshot below)
This particular Ubuntu system provides Nvidia 535.138 driver version, which supports cuda 12.2. Cuda 12.2 is not listed in Pytorch's support matrix (it lists 11.8, 12.1, 12.4). So while it is not technically suitable
Per https://github.com/pmeier/light-the-torch/pull/111#issue-1534643067, Table 2 of https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html is what light-the-torch uses where CUDA driver is the only thing important for running pre-compiled binaries and not the CUDA toolkit version. On Linux, CUDA 11.1.x and newer binaries require using driver >=450.80.02 while CUDA 12.x binaries require using driver >=525.60.13. So your driver version is suitable for the Cu124 compute backend for torch.
If we change the computation backend from automatic and cu118, correct versions of all libraries is installed (see the screenshot below)
I suspect this was successful partially due to there not being cached versions of the cu118 whl files on your system allowing for it to pull the latest versions from the web.
@muratmaga On Windows with a cleared pip cache (%LOCALAPPDATA%\pip\cache) and a fresh Slicer 5.8.0 install, I installed PyTorch using the automatic computation backend and it appropriately pulled latest PyTorch 2.6.0+cu126 along with compatible TorchVision 0.21.0+cu126.
SlicerPyTorch python console output click here
Python 3.9.10 (main, Jan 23 2025, 23:04:06) [MSC v.1942 64 bit (AMD64)] on win32
>>>
Collecting light-the-torch>=0.5
Downloading light_the_torch-0.8.0-py3-none-any.whl.metadata (9.3 kB)
Requirement already satisfied: pip<24.4,>=22.3 in c:\users\butlej30383\appdata\local\slicer.org\slicer 5.8.0\lib\python\lib\site-packages (from light-the-torch>=0.5) (24.0)
Downloading light_the_torch-0.8.0-py3-none-any.whl (14 kB)
Installing collected packages: light-the-torch
Successfully installed light-the-torch-0.8.0
Collecting torch
Downloading https://download.pytorch.org/whl/cu126/torch-2.6.0%2Bcu126-cp39-cp39-win_amd64.whl.metadata (28 kB)
Collecting torchvision
Downloading https://download.pytorch.org/whl/cu126/torchvision-0.21.0%2Bcu126-cp39-cp39-win_amd64.whl.metadata (6.3 kB)
Collecting filelock (from torch)
Downloading https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: typing-extensions>=4.10.0 in c:\users\butlej30383\appdata\local\slicer.org\slicer 5.8.0\lib\python\lib\site-packages (from torch) (4.12.1)
Collecting networkx (from torch)
Downloading https://download.pytorch.org/whl/networkx-3.3-py3-none-any.whl.metadata (5.1 kB)
Collecting jinja2 (from torch)
Downloading jinja2-3.1.5-py3-none-any.whl.metadata (2.6 kB)
Collecting fsspec (from torch)
Downloading https://download.pytorch.org/whl/fsspec-2024.6.1-py3-none-any.whl.metadata (11 kB)
Collecting sympy==1.13.1 (from torch)
Downloading https://download.pytorch.org/whl/sympy-1.13.1-py3-none-any.whl (6.2 MB)
---------------------------------------- 6.2/6.2 MB 30.4 MB/s eta 0:00:00
Collecting mpmath<1.4,>=1.1.0 (from sympy==1.13.1->torch)
Downloading https://download.pytorch.org/whl/mpmath-1.3.0-py3-none-any.whl (536 kB)
------------------------------------- 536.2/536.2 kB 32.9 MB/s eta 0:00:00
Requirement already satisfied: numpy in c:\users\butlej30383\appdata\local\slicer.org\slicer 5.8.0\lib\python\lib\site-packages (from torchvision) (1.26.4)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\users\butlej30383\appdata\local\slicer.org\slicer 5.8.0\lib\python\lib\site-packages (from torchvision) (10.3.0)
Collecting MarkupSafe>=2.0 (from jinja2->torch)
Downloading MarkupSafe-3.0.2-cp39-cp39-win_amd64.whl.metadata (4.1 kB)
INFO: pip is looking at multiple versions of networkx to determine which version is compatible with other requirements. This could take a while.
Collecting networkx (from torch)
Downloading https://download.pytorch.org/whl/networkx-3.2.1-py3-none-any.whl (1.6 MB)
---------------------------------------- 1.6/1.6 MB 34.8 MB/s eta 0:00:00
Downloading https://download.pytorch.org/whl/cu126/torch-2.6.0%2Bcu126-cp39-cp39-win_amd64.whl (2496.0 MB)
---------------------------------------- 2.5/2.5 GB 2.7 MB/s eta 0:00:00
Downloading https://download.pytorch.org/whl/cu126/torchvision-0.21.0%2Bcu126-cp39-cp39-win_amd64.whl (6.1 MB)
---------------------------------------- 6.1/6.1 MB 23.1 MB/s eta 0:00:00
Downloading https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl (11 kB)
Downloading https://download.pytorch.org/whl/fsspec-2024.6.1-py3-none-any.whl (177 kB)
--------------------------------------- 177.6/177.6 kB 11.2 MB/s eta 0:00:00
Downloading jinja2-3.1.5-py3-none-any.whl (134 kB)
---------------------------------------- 134.6/134.6 kB 4.0 MB/s eta 0:00:00
Downloading MarkupSafe-3.0.2-cp39-cp39-win_amd64.whl (15 kB)
Installing collected packages: mpmath, sympy, networkx, MarkupSafe, fsspec, filelock, jinja2, torch, torchvision
Successfully installed MarkupSafe-3.0.2 filelock-3.13.1 fsspec-2024.6.1 jinja2-3.1.5 mpmath-1.3.0 networkx-3.2.1 sympy-1.13.1 torch-2.6.0+cu126 torchvision-0.21.0+cu126
That unfortunately is not my experience on a fresh Linux (ubuntu system), with a fresh Slicer (5.8) install:
@muratmaga can you share your console output?
[DEBUG][Qt] 03.02.2025 22:40:01 [] (unknown:0) - Session start time .......: 20250203_224001
[DEBUG][Qt] 03.02.2025 22:40:01 [] (unknown:0) - Slicer version ...........: 5.8.0 (revision 33216 / d20ee94) linux-amd64 - installed release
[DEBUG][Qt] 03.02.2025 22:40:01 [] (unknown:0) - Operating system .........: Linux / 6.8.0-52-generic / #53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 19:18:46 UTC 2 / UTF-8 - 64-bit
[DEBUG][Qt] 03.02.2025 22:40:01 [] (unknown:0) - Memory ...................: 117901 MB physical, 0 MB virtual
[DEBUG][Qt] 03.02.2025 22:40:01 [] (unknown:0) - CPU ......................: AuthenticAMD AMD EPYC-Milan Processor, 32 cores, 32 logical processors
[DEBUG][Qt] 03.02.2025 22:40:01 [] (unknown:0) - VTK configuration ........: OpenGL2 rendering, TBB threading
[DEBUG][Qt] 03.02.2025 22:40:01 [] (unknown:0) - Qt configuration .........: version 5.15.2, with SSL, requested OpenGL 3.2 (core profile)
[DEBUG][Qt] 03.02.2025 22:40:01 [] (unknown:0) - DCMTK configuration ......: version 3.6.8, no SSL
[DEBUG][Qt] 03.02.2025 22:40:01 [] (unknown:0) - Internationalization .....: disabled, language=
[DEBUG][Qt] 03.02.2025 22:40:01 [] (unknown:0) - Developer mode ...........: disabled
[DEBUG][Qt] 03.02.2025 22:40:01 [] (unknown:0) - Application path .........: /media/volume/MyData/Slicer/bin
[DEBUG][Qt] 03.02.2025 22:40:01 [] (unknown:0) - Additional module paths ..: slicer.org/Extensions-33216/SegmentEditorExtraEffects/lib/Slicer-5.8/qt-loadable-modules, slicer.org/Extensions-33216/SegmentEditorExtraEffects/lib/Slicer-5.8/qt-scripted-modules, slicer.org/Extensions-33216/SurfaceMarkup/lib/Slicer-5.8/qt-loadable-modules, slicer.org/Extensions-33216/SlicerMorph/lib/Slicer-5.8/qt-scripted-modules, slicer.org/Extensions-33216/MarkupsToModel/lib/Slicer-5.8/qt-loadable-modules, slicer.org/Extensions-33216/SurfaceWrapSolidify/lib/Slicer-5.8/qt-scripted-modules, slicer.org/Extensions-33216/PyTorch/lib/Slicer-5.8/qt-scripted-modules
[WARNING][Qt] 03.02.2025 22:40:07 [] (unknown:0) - libpng warning: iCCP: profile 'ICC Profile': 'CMYK': invalid ICC profile color space
[WARNING][Qt] 03.02.2025 22:40:07 [] (unknown:0) - libpng warning: iCCP: known incorrect sRGB profile
[DEBUG][Python] 03.02.2025 22:40:07 [Python] (/media/volume/MyData/Slicer/lib/Slicer-5.8/qt-scripted-modules/SubjectHierarchyPlugins/AbstractScriptedSubjectHierarchyPlugin.py:40) - Scripted subject hierarchy plugin registered: SegmentEditor
[DEBUG][Python] 03.02.2025 22:40:07 [Python] (/media/volume/MyData/Slicer/lib/Slicer-5.8/qt-scripted-modules/SubjectHierarchyPlugins/AbstractScriptedSubjectHierarchyPlugin.py:40) - Scripted subject hierarchy plugin registered: SegmentStatistics
[DEBUG][Qt] 03.02.2025 22:40:08 [] (unknown:0) - Switch to module: "Welcome"
[DEBUG][Python] 03.02.2025 22:40:08 [Python] (/media/volume/MyData/Slicer/lib/Slicer-5.8/qt-scripted-modules/SubjectHierarchyPlugins/AbstractScriptedSubjectHierarchyPlugin.py:40) - Scripted subject hierarchy plugin registered: FormatMarkups
[INFO][Python] 03.02.2025 22:40:08 [Python] (<string>:3) - Adding SlicerMorph Volume Rendering Presets
[DEBUG][Qt] 03.02.2025 22:40:18 [] (unknown:0) - Switch to module: "PyTorchUtils"
[INFO][Python] 03.02.2025 22:40:22 [Python] (/media/volume/MyData/Slicer/bin/Python/slicer/util.py:3057) - PyTorch will be downloaded and installed using light-the-torch (ltt install torch torchvision). The process might take some minutes.
[INFO][Python] 03.02.2025 22:40:24 [Python] (/media/volume/MyData/Slicer/slicer.org/Extensions-33216/PyTorch/lib/Slicer-5.8/qt-scripted-modules/PyTorchUtils.py:216) - Install PyTorch using light-the-torch with arguments: ['install', 'torch', 'torchvision']
[INFO][Stream] 03.02.2025 22:40:25 [] (unknown:0) - Collecting light-the-torch>=0.5
[INFO][Stream] 03.02.2025 22:40:25 [] (unknown:0) - Downloading light_the_torch-0.8.0-py3-none-any.whl.metadata (9.3 kB)
[INFO][Stream] 03.02.2025 22:40:25 [] (unknown:0) - Requirement already satisfied: pip<24.4,>=22.3 in ./Slicer/lib/Python/lib/python3.9/site-packages (from light-the-torch>=0.5) (24.0)
[INFO][Stream] 03.02.2025 22:40:25 [] (unknown:0) - Downloading light_the_torch-0.8.0-py3-none-any.whl (14 kB)
[INFO][Stream] 03.02.2025 22:40:26 [] (unknown:0) - Installing collected packages: light-the-torch
[INFO][Stream] 03.02.2025 22:40:26 [] (unknown:0) - Successfully installed light-the-torch-0.8.0
[DEBUG][Python] 03.02.2025 22:40:26 [Python] (/media/volume/MyData/Slicer/lib/Python/lib/python3.9/site-packages/pip/_internal/vcs/versioncontrol.py:225) - Registered VCS backend: bzr
[DEBUG][Python] 03.02.2025 22:40:26 [Python] (/media/volume/MyData/Slicer/lib/Python/lib/python3.9/site-packages/pip/_internal/vcs/versioncontrol.py:225) - Registered VCS backend: git
[DEBUG][Python] 03.02.2025 22:40:26 [Python] (/media/volume/MyData/Slicer/lib/Python/lib/python3.9/site-packages/pip/_internal/vcs/versioncontrol.py:225) - Registered VCS backend: hg
[DEBUG][Python] 03.02.2025 22:40:26 [Python] (/media/volume/MyData/Slicer/lib/Python/lib/python3.9/site-packages/pip/_internal/vcs/versioncontrol.py:225) - Registered VCS backend: svn
[INFO][Stream] 03.02.2025 22:40:30 [] (unknown:0) - Collecting torch
[INFO][Stream] 03.02.2025 22:40:30 [] (unknown:0) - Downloading https://download.pytorch.org/whl/cu124/torch-2.6.0%2Bcu124-cp39-cp39-linux_x86_64.whl.metadata (28 kB)
[INFO][Stream] 03.02.2025 22:40:32 [] (unknown:0) - Collecting torchvision
[INFO][Stream] 03.02.2025 22:40:32 [] (unknown:0) - Downloading https://download.pytorch.org/whl/cu126/torchvision-0.21.0%2Bcu126-cp39-cp39-linux_x86_64.whl.metadata (6.1 kB)
[INFO][Stream] 03.02.2025 22:40:34 [] (unknown:0) - Collecting filelock (from torch)
[INFO][Stream] 03.02.2025 22:40:34 [] (unknown:0) - Downloading https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)
[INFO][Stream] 03.02.2025 22:40:34 [] (unknown:0) - Requirement already satisfied: typing-extensions>=4.10.0 in ./Slicer/lib/Python/lib/python3.9/site-packages (from torch) (4.12.1)
[INFO][Stream] 03.02.2025 22:40:36 [] (unknown:0) - Collecting networkx (from torch)
[INFO][Stream] 03.02.2025 22:40:36 [] (unknow4n:0) - Downloading https://download.pytorch.org/whl/networkx-3.3-py3-none-any.whl.metadata (5.1 kB)
[INFO][Stream] 03.02.2025 22:40:36 [] (unknown:0) - Collecting jinja2 (from torch)
[INFO][Stream] 03.02.2025 22:40:36 [] (unknown:0) - Downloading jinja2-3.1.5-py3-none-any.whl.metadata (2.6 kB)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Collecting fsspec (from torch)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Downloading https://download.pytorch.org/whl/fsspec-2024.6.1-py3-none-any.whl.metadata (11 kB)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Collecting nvidia-cuda-nvrtc-cu12==12.4.127 (from torch)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Downloading nvidia_cuda_nvrtc_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Collecting nvidia-cuda-runtime-cu12==12.4.127 (from torch)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Downloading nvidia_cuda_runtime_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Collecting nvidia-cuda-cupti-cu12==12.4.127 (from torch)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Downloading nvidia_cuda_cupti_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.6 kB)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Collecting nvidia-cudnn-cu12==9.1.0.70 (from torch)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Downloading nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl.metadata (1.6 kB)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Collecting nvidia-cublas-cu12==12.4.5.8 (from torch)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Downloading nvidia_cublas_cu12-12.4.5.8-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Collecting nvidia-cufft-cu12==11.2.1.3 (from torch)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Downloading nvidia_cufft_cu12-11.2.1.3-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Collecting nvidia-curand-cu12==10.3.5.147 (from torch)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Downloading nvidia_curand_cu12-10.3.5.147-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Collecting nvidia-cusolver-cu12==11.6.1.9 (from torch)
[INFO][Stream] 03.02.2025 22:40:38 [] (unknown:0) - Downloading nvidia_cusolver_cu12-11.6.1.9-py3-none-manylinux2014_x86_64.whl.metadata (1.6 kB)
[INFO][Stream] 03.02.2025 22:40:39 [] (unknown:0) - Collecting nvidia-cusparse-cu12==12.3.1.170 (from torch)
[INFO][Stream] 03.02.2025 22:40:39 [] (unknown:0) - Downloading nvidia_cusparse_cu12-12.3.1.170-py3-none-manylinux2014_x86_64.whl.metadata (1.6 kB)
[INFO][Stream] 03.02.2025 22:40:39 [] (unknown:0) - Collecting nvidia-cusparselt-cu12==0.6.2 (from torch)
[INFO][Stream] 03.02.2025 22:40:39 [] (unknown:0) - Downloading nvidia_cusparselt_cu12-0.6.2-py3-none-manylinux2014_x86_64.whl.metadata (6.8 kB)
[INFO][Stream] 03.02.2025 22:40:39 [] (unknown:0) - Collecting nvidia-nccl-cu12==2.21.5 (from torch)
[INFO][Stream] 03.02.2025 22:40:39 [] (unknown:0) - Downloading nvidia_nccl_cu12-2.21.5-py3-none-manylinux2014_x86_64.whl.metadata (1.8 kB)
[INFO][Stream] 03.02.2025 22:40:39 [] (unknown:0) - Collecting nvidia-nvtx-cu12==12.4.127 (from torch)
[INFO][Stream] 03.02.2025 22:40:39 [] (unknown:0) - Downloading nvidia_nvtx_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.7 kB)
[INFO][Stream] 03.02.2025 22:40:39 [] (unknown:0) - Collecting nvidia-nvjitlink-cu12==12.4.127 (from torch)
[INFO][Stream] 03.02.2025 22:40:39 [] (unknown:0) - Downloading nvidia_nvjitlink_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)
[INFO][Stream] 03.02.2025 22:40:39 [] (unknown:0) - Collecting triton==3.2.0 (from torch)
[INFO][Stream] 03.02.2025 22:40:39 [] (unknown:0) - Downloading triton-3.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.4 kB)
[INFO][Stream] 03.02.2025 22:40:41 [] (unknown:0) - Collecting sympy==1.13.1 (from torch)
[INFO][Stream] 03.02.2025 22:40:41 [] (unknown:0) - Downloading https://download.pytorch.org/whl/sympy-1.13.1-py3-none-any.whl (6.2 MB)
[INFO][Stream] 03.02.2025 22:40:41 [] (unknown:0) - ???????????????????????????????????????? 6.2/6.2 MB 81.0 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:40:43 [] (unknown:0) - Collecting mpmath<1.4,>=1.1.0 (from sympy==1.13.1->torch)
[INFO][Stream] 03.02.2025 22:40:43 [] (unknown:0) - Downloading https://download.pytorch.org/whl/mpmath-1.3.0-py3-none-any.whl (536 kB)
[INFO][Stream] 03.02.2025 22:40:43 [] (unknown:0) - ?????????????????????????????????????? 536.2/536.2 kB 43.2 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:40:43 [] (unknown:0) - Requirement already satisfied: numpy in ./Slicer/lib/Python/lib/python3.9/site-packages (from torchvision) (1.26.4)
[INFO][Stream] 03.02.2025 22:40:43 [] (unknown:0) - Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in ./Slicer/lib/Python/lib/python3.9/site-packages (from torchvision) (10.3.0)
[INFO][Stream] 03.02.2025 22:40:43 [] (unknown:0) - Collecting MarkupSafe>=2.0 (from jinja2->torch)
[INFO][Stream] 03.02.2025 22:40:43 [] (unknown:0) - Downloading MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.0 kB)
[INFO][Stream] 03.02.2025 22:40:43 [] (unknown:0) - INFO: pip is looking at multiple versions of networkx to determine which version is compatible with other requirements. This could take a while.
[INFO][Stream] 03.02.2025 22:40:43 [] (unknown:0) - Collecting networkx (from torch)
[INFO][Stream] 03.02.2025 22:40:43 [] (unknown:0) - Downloading https://download.pytorch.org/whl/networkx-3.2.1-py3-none-any.whl (1.6 MB)
[INFO][Stream] 03.02.2025 22:40:43 [] (unknown:0) - ???????????????????????????????????????? 1.6/1.6 MB 72.5 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:40:43 [] (unknown:0) - Downloading https://download.pytorch.org/whl/cu124/torch-2.6.0%2Bcu124-cp39-cp39-linux_x86_64.whl (768.4 MB)
[INFO][Stream] 03.02.2025 22:40:49 [] (unknown:0) - ???????????????????????????????????????? 768.4/768.4 MB 7.0 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:40:49 [] (unknown:0) - Downloading nvidia_cublas_cu12-12.4.5.8-py3-none-manylinux2014_x86_64.whl (363.4 MB)
[INFO][Stream] 03.02.2025 22:40:53 [] (unknown:0) - ???????????????????????????????????????? 363.4/363.4 MB 12.0 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:40:53 [] (unknown:0) - Downloading nvidia_cuda_cupti_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (13.8 MB)
[INFO][Stream] 03.02.2025 22:40:53 [] (unknown:0) - ???????????????????????????????????????? 13.8/13.8 MB 85.4 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:40:53 [] (unknown:0) - Downloading nvidia_cuda_nvrtc_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (24.6 MB)
[INFO][Stream] 03.02.2025 22:40:54 [] (unknown:0) - ???????????????????????????????????????? 24.6/24.6 MB 75.1 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:40:54 [] (unknown:0) - Downloading nvidia_cuda_runtime_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (883 kB)
[INFO][Stream] 03.02.2025 22:40:54 [] (unknown:0) - ???????????????????????????????????????? 883.7/883.7 kB 51.9 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:40:54 [] (unknown:0) - Downloading nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl (664.8 MB)
[INFO][Stream] 03.02.2025 22:41:00 [] (unknown:0) - ???????????????????????????????????????? 664.8/664.8 MB 7.9 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:00 [] (unknown:0) - Downloading nvidia_cufft_cu12-11.2.1.3-py3-none-manylinux2014_x86_64.whl (211.5 MB)
[INFO][Stream] 03.02.2025 22:41:01 [] (unknown:0) - ???????????????????????????????????????? 211.5/211.5 MB 21.4 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:02 [] (unknown:0) - Downloading nvidia_curand_cu12-10.3.5.147-py3-none-manylinux2014_x86_64.whl (56.3 MB)
[INFO][Stream] 03.02.2025 22:41:02 [] (unknown:0) - ???????????????????????????????????????? 56.3/56.3 MB 52.6 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:02 [] (unknown:0) - Downloading nvidia_cusolver_cu12-11.6.1.9-py3-none-manylinux2014_x86_64.whl (127.9 MB)
[INFO][Stream] 03.02.2025 22:41:03 [] (unknown:0) - ???????????????????????????????????????? 127.9/127.9 MB 31.1 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:03 [] (unknown:0) - Downloading nvidia_cusparse_cu12-12.3.1.170-py3-none-manylinux2014_x86_64.whl (207.5 MB)
[INFO][Stream] 03.02.2025 22:41:05 [] (unknown:0) - ???????????????????????????????????????? 207.5/207.5 MB 22.8 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:05 [] (unknown:0) - Downloading nvidia_cusparselt_cu12-0.6.2-py3-none-manylinux2014_x86_64.whl (150.1 MB)
[INFO][Stream] 03.02.2025 22:41:06 [] (unknown:0) - ???????????????????????????????????????? 150.1/150.1 MB 28.0 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:06 [] (unknown:0) - Downloading nvidia_nccl_cu12-2.21.5-py3-none-manylinux2014_x86_64.whl (188.7 MB)
[INFO][Stream] 03.02.2025 22:41:08 [] (unknown:0) - ???????????????????????????????????????? 188.7/188.7 MB 23.2 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:08 [] (unknown:0) - Downloading nvidia_nvjitlink_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (21.1 MB)
[INFO][Stream] 03.02.2025 22:41:08 [] (unknown:0) - ???????????????????????????????????????? 21.1/21.1 MB 75.1 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:08 [] (unknown:0) - Downloading nvidia_nvtx_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (99 kB)
[INFO][Stream] 03.02.2025 22:41:08 [] (unknown:0) - ???????????????????????????????????????? 99.1/99.1 kB 13.0 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:08 [] (unknown:0) - Downloading triton-3.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (253.1 MB)
[INFO][Stream] 03.02.2025 22:41:11 [] (unknown:0) - ???????????????????????????????????????? 253.1/253.1 MB 18.7 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:11 [] (unknown:0) - Downloading https://download.pytorch.org/whl/cu126/torchvision-0.21.0%2Bcu126-cp39-cp39-linux_x86_64.whl (7.3 MB)
[INFO][Stream] 03.02.2025 22:41:11 [] (unknown:0) - ???????????????????????????????????????? 7.3/7.3 MB 22.2 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:11 [] (unknown:0) - Downloading https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl (11 kB)
[INFO][Stream] 03.02.2025 22:41:11 [] (unknown:0) - Downloading https://download.pytorch.org/whl/fsspec-2024.6.1-py3-none-any.whl (177 kB)
[INFO][Stream] 03.02.2025 22:41:11 [] (unknown:0) - ???????????????????????????????????????? 177.6/177.6 kB 22.0 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:11 [] (unknown:0) - Downloading jinja2-3.1.5-py3-none-any.whl (134 kB)
[INFO][Stream] 03.02.2025 22:41:11 [] (unknown:0) - ???????????????????????????????????????? 134.6/134.6 kB 18.0 MB/s eta 0:00:00
[INFO][Stream] 03.02.2025 22:41:11 [] (unknown:0) - Downloading MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20 kB)
[INFO][Stream] 03.02.2025 22:41:15 [] (unknown:0) - Installing collected packages: triton, nvidia-cusparselt-cu12, mpmath, sympy, nvidia-nvtx-cu12, nvidia-nvjitlink-cu12, nvidia-nccl-cu12, nvidia-curand-cu12, nvidia-cufft-cu12, nvidia-cuda-runtime-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-cupti-cu12, nvidia-cublas-cu12, networkx, MarkupSafe, fsspec, filelock, nvidia-cusparse-cu12, nvidia-cudnn-cu12, jinja2, nvidia-cusolver-cu12, torch, torchvision
[INFO][Stream] 03.02.2025 22:42:05 [] (unknown:0) - Successfully installed MarkupSafe-3.0.2 filelock-3.13.1 fsspec-2024.6.1 jinja2-3.1.5 mpmath-1.3.0 networkx-3.2.1 nvidia-cublas-cu12-12.4.5.8 nvidia-cuda-cupti-cu12-12.4.127 nvidia-cuda-nvrtc-cu12-12.4.127 nvidia-cuda-runtime-cu12-12.4.127 nvidia-cudnn-cu12-9.1.0.70 nvidia-cufft-cu12-11.2.1.3 nvidia-curand-cu12-10.3.5.147 nvidia-cusolver-cu12-11.6.1.9 nvidia-cusparse-cu12-12.3.1.170 nvidia-cusparselt-cu12-0.6.2 nvidia-nccl-cu12-2.21.5 nvidia-nvjitlink-cu12-12.4.127 nvidia-nvtx-cu12-12.4.127 sympy-1.13.1 torch-2.6.0+cu124 torchvision-0.21.0+cu126 triton-3.2.0
[INFO][Python] 03.02.2025 22:42:08 [Python] (/media/volume/MyData/Slicer/slicer.org/Extensions-33216/PyTorch/lib/Slicer-5.8/qt-scripted-modules/PyTorchUtils.py:226) - PyTorch 2.6.0+cu124 installed successfully.
[INFO][Python] 03.02.2025 22:42:08 [Python] (/media/volume/MyData/Slicer/slicer.org/Extensions-33216/PyTorch/lib/Slicer-5.8/qt-scripted-modules/PyTorchUtils.py:153) - Importing torch...
[INFO][Python] 03.02.2025 22:42:08 [Python] (/media/volume/MyData/Slicer/slicer.org/Extensions-33216/PyTorch/lib/Slicer-5.8/qt-scripted-modules/PyTorchUtils.py:190) - PyTorch 2.6.0+cu124 imported successfully
[INFO][Python] 03.02.2025 22:42:09 [Python] (/media/volume/MyData/Slicer/slicer.org/Extensions-33216/PyTorch/lib/Slicer-5.8/qt-scripted-modules/PyTorchUtils.py:191) - CUDA available: True
[INFO][Python] 03.02.2025 22:42:09 [Python] (/media/volume/MyData/Slicer/bin/Python/slicer/util.py:2925) - PyTorch 2.6.0+cu124 installed successfully using cuda.
[ERROR][Python] 03.02.2025 22:42:11 [Python] (/media/volume/MyData/Slicer/slicer.org/Extensions-33216/PyTorch/lib/Slicer-5.8/qt-scripted-modules/PyTorchUtils.py:98) - operator torchvision::nms does not exist
[DEBUG][Qt] 03.02.2025 22:43:25 [] (unknown:0) - Switch to module: ""
While it seems to start installing the correct version of torchvision, this is the error after restarting slicer (hence corrupt install message).
>>> import torchvision
[Qt] libpng warning: iCCP: profile 'ICC Profile': 'CMYK': invalid ICC profile color space
[Qt] libpng warning: iCCP: known incorrect sRGB profile
[Python] operator torchvision::nms does not exist
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/media/volume/MyData/Slicer/lib/Python/lib/python3.9/site-packages/torchvision/__init__.py", line 10, in <module>
from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils # usort:skip
File "/media/volume/MyData/Slicer/lib/Python/lib/python3.9/site-packages/torchvision/_meta_registrations.py", line 26, in <module>
def meta_roi_align(input, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio, aligned):
File "/media/volume/MyData/Slicer/lib/Python/lib/python3.9/site-packages/torchvision/_meta_registrations.py", line 18, in wrapper
if torchvision.extension._has_ops():
AttributeError: partially initialized module 'torchvision' has no attribute 'extension' (most likely due to a circular import)
And when I force 11.8 as requisite, everything works:
It appears you got latest PyTorch (2.6.0) and latest Torchvision (0.21.0), however it appears to have retrieved PyTorch 2.6.0+cu124 which is actually the default on Linux, but then got Torchvision 0.21.0+cu126 which is a different compute backend. I suspect this is responsible for the error you observed. On Windows the default PyTorch is actually the CPU version which is different from Linux. Oddly the Linux default is the cu124 package which is not even the latest compute backend which is cu126.
@muratmaga I would expect from a fresh Slicer instance again that it would work if you specify the computation backend of cu126 to encourage it getting PyTorch 2.6.0+cu126. I think using a cu11x package is possible with an Nvidia driver >500, but that version of the driver began support for CUDA 12, so using a cu12x package is probably your better bet if you are going to force a computation backend.
This may be relevant:
- https://github.com/MorphoCloud/MorphoCloudWorkflow/issues/66#issuecomment-2544038590
- https://github.com/Slicer/Slicer/pull/8168
possibly relevant: https://github.com/dalcalab/SlicerMultiverSeg/issues/34
Has anyone found a solution?
I don't think there is an issue in general but there are isolated cases of Python environments messed up by installing some very old version by default and then manually installing pytorch version that is incompatible with the system.
When extensions install PyTorch, they can write their minimum version requirement. If the user installs pytorch manually, he can write version requirement in the Torch version requirement field and then click Install PyTorch.
This is no longer happening with the latest preview versions, so I stopped chasing it.
Reopening as unfortunately this happens with today's preview version on my Apple M2.
Downloading https://download.pytorch.org/whl/cpu/torch-2.2.2-cp312-none-macosx_10_9_x86_64.whl
Downloading https://download.pytorch.org/whl/cpu/torch-2.2.2-cp312-none-macosx_11_0_arm64.whl (59.3 MB)
~Something I've noticed is that in Slicer I get the former, while I get the latter when installing torch==2.2.2 with ltt from my terminal. The version of light-the-torch is 0.8.0 in both environments. Maybe @jcfr knows why this might be?~
Never mind. I guess Slicer’s Python is Intel (x86_64 under Rosetta), so pip picks the Intel wheel.
I've done some LLM digging and it seems that
The correct match for torch==2.2.2 is torchvision==0.17.2, and there’s a cp312 macOS arm64 wheel for it on PyPI — but that file isn’t present on the PyTorch index you’re hitting.
@pmeier, does ltt force to download from the PyTorch index? Could the problem be related to that?
Reviewing https://download.pytorch.org/whl/torchvision/ there are 55 different whls when searching for 0.17.2.
Including a macOS arm whl though of course no CUDA whl for macOS arm since they don’t have Nvidia GPUs:
https://download.pytorch.org/whl/cpu/torchvision-0.17.2-cp312-cp312-macosx_11_0_arm64.whl#sha256=9c3acbebbe379af112b62b535820174277b1f3eed30df264a4e458d58ee4e5b2
and the intel variant: https://download.pytorch.org/whl/cpu/torchvision-0.17.2-cp312-cp312-macosx_10_13_x86_64.whl#sha256=14fd1d4a033c325bdba2d03a69c3450cab6d3a625f85cc375781d9237ca5d04d
@fepegar See https://github.com/Slicer/light-the-torch?tab=readme-ov-file#is-it-safe about when the PyTorch index is used to get the whls. It pulls from PyPI only if a third party dependency has been pinned.
Thanks for checking, @jamesobutler. I clearly shouldn't have trusted the bot.
But I guess we still don't know why ltt is installing torchvision 0.2.0.