I have been trying to install one package in slicer and I am facing the following issue
Building wheels for collected packages: spatial_correlation_sampler
Building wheel for spatial_correlation_sampler (pyproject.toml) … error
error: subprocess-exited-with-error
× Building wheel for spatial_correlation_sampler (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
running bdist_wheel
C:\Users\TestProfile\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\site-packages\torch\utils\cpp_extension.py:495: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja… Falling back to using the slow distutils backend.
warnings.warn(msg.format(‘we could not find ninja.’))
running build
running build_py
creating build\lib.win-amd64-cpython-39\spatial_correlation_sampler
copying Correlation_Module\spatial_correlation_sampler\spatial_correlation_sampler.py → build\lib.win-amd64-cpython-39\spatial_correlation_sampler
copying Correlation_Module\spatial_correlation_sampler_init_.py → build\lib.win-amd64-cpython-39\spatial_correlation_sampler
running build_ext
C:\Users\TestProfile\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\site-packages\torch\utils\cpp_extension.py:414: UserWarning: The detected CUDA version (12.6) has a minor version mismatch with the version that was used to compile PyTorch (12.1). Most likely this shouldn’t be a problem.
warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
building ‘spatial_correlation_sampler_backend’ extension
creating build\temp.win-amd64-cpython-39\Release\Correlation_Module
“C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.42.34321\bin\HostX86\x64\cl.exe” /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DUSE_CUDA “-IC:\Users\TestProfile\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\site-packages\torch\include” “-IC:\Users\TestProfile\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\site-packages\torch\include\torch\csrc\api\include” “-IC:\Users\TestProfile\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\site-packages\torch\include\TH” “-IC:\Users\TestProfile\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\site-packages\torch\include\THC” “-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\include” “-IC:\Users\TestProfile\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\include” “-IC:\Users\TestProfile\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Include” “-IC:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.42.34321\include” “-IC:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.42.34321\ATLMFC\include” “-IC:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\VS\include” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt” “-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um” /EHsc /TpCorrelation_Module\correlation.cpp /Fobuild\temp.win-amd64-cpython-39\Release\Correlation_Module\correlation.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc -std=c++17 -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=spatial_correlation_sampler_backend -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++17
cl : Command line warning D9002 : ignoring unknown option ‘-std=c++17’
cl : Command line warning D9002 : ignoring unknown option ‘-fopenmp’
correlation.cpp
C:\Users\TestProfile\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\site-packages\torch\include\torch/csrc/python_headers.h(12): fatal error C1083: Cannot open include file: ‘Python.h’: No such file or directory
error: command ‘C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.42.34321\bin\HostX86\x64\cl.exe’ failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for spatial_correlation_sampler
Failed to build spatial_correlation_sampler
ERROR: Could not build wheels for spatial_correlation_sampler, which is required to install pyproject.toml-based projects
[notice] A new release of pip is available: 23.0 → 24.2
[notice] To update, run: python-real.exe -m pip install --upgrade pip
PS C:\Users\TestProfile\AppData\Local\NA-MIC\Slicer 5.2.2\bin> PythonSlicer.exe -m pip install python-dev
ERROR: Could not find a version that satisfies the requirement python-dev (from versions: none)
ERROR: No matching distribution found for python-dev
[notice] A new release of pip is available: 23.0 → 24.2
Read the following linked post about methods of installing packages where Whl files are having to be built from source. To summarize, build the Whl in a system install of Python and use the cached Whl file to install in the Slicer Python. A Python package requiring build from source with no Whl files available from PyPI is generally an indication of a Python project with not a lot of support.
Which code is it? Slicer developers don’t support older versions of Slicer, but can help provide guidance on the latest stable and preview releases of Slicer.
How can we get you to use latest Slicer stable and preview version? Slicer 5.2.2 is quite old. Are there compatibility issues with latest Slicer? Slicer developers can help with that.
Others might chime in but i think you will have to build both Slicer and this python package from source using the same build tools to avoid that problem.
I thought things worked in ubuntu, maybe focus on working on that?
I am actually consuming one of the plugin which is developed with this version of Slicer and making changes to it . Thats the main reason I using this version. Tried with latest version of slicer but the plugin is not working