Skip to content

Windows11 python 3.12 cuda 13.0 torch 2.9.1 Compilation failed #319

@wzgrx

Description

@wzgrx

Environment
window11 4090 24gb python3.12 cuda12.9.1

pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu130

When trying to install from source on Windows using Python 3.12, the build fails
🖥️ Environment
OS: Windows 11
Python: 3.12
PyTorch: 2.4+ (compiled with CUDA 12.9.1)
NVCC: 13.0
CUDA: 12.9.1

[notice] A new release of pip is available: 25.0.1 -> 25.3
[notice] To update, run: python.exe -m pip install --upgrade pip
(venv) PS E:\SageAttention> # 1. 设置环境变量
(venv) PS E:\SageAttention> $env:EXT_PARALLEL = "4"
(venv) PS E:\SageAttention> $env:NVCC_APPEND_FLAGS = "--threads 8"
(venv) PS E:\SageAttention> $env:MAX_JOBS = "32"
(venv) PS E:\SageAttention>
(venv) PS E:\SageAttention> # 2. 安装依赖
(venv) PS E:\SageAttention> pip install packaging setuptools wheel
Requirement already satisfied: packaging in e:\sageattention\venv\lib\site-packages (25.0)
Requirement already satisfied: setuptools in e:\sageattention\venv\lib\site-packages (70.2.0)
Requirement already satisfied: wheel in e:\sageattention\venv\lib\site-packages (0.45.1)

[notice] A new release of pip is available: 25.0.1 -> 25.3
[notice] To update, run: python.exe -m pip install --upgrade pip
(venv) PS E:\SageAttention>
(venv) PS E:\SageAttention> # 3. 尝试安装
(venv) PS E:\SageAttention> python setup.py install
Target compute capabilities: {'12.0'}
running install
E:\SageAttention\venv\Lib\site-packages\setuptools_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

    ********************************************************************************
    Please avoid running ``setup.py`` directly.
    Instead, use pypa/build, pypa/installer or other
    standards-based tools.

    See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
    ********************************************************************************

!!
self.initialize_options()
E:\SageAttention\venv\Lib\site-packages\setuptools_distutils\cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

    ********************************************************************************
    Please avoid running ``setup.py`` and ``easy_install``.
    Instead, use pypa/build, pypa/installer or other
    standards-based tools.

    See https://github.com/pypa/setuptools/issues/917 for details.
    ********************************************************************************

!!
self.initialize_options()
running bdist_egg
running egg_info
writing sageattention.egg-info\PKG-INFO
writing dependency_links to sageattention.egg-info\dependency_links.txt
writing top-level names to sageattention.egg-info\top_level.txt
W1202 18:13:09.956000 28948 venv\Lib\site-packages\torch\utils\cpp_extension.py:630] Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
reading manifest file 'sageattention.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '.hpp' under directory 'csrc'
warning: no previously-included files matching 'pycache' found anywhere in distribution
warning: no previously-included files matching '
.py[cod]' found anywhere in distribution
adding license file 'LICENSE'
writing manifest file 'sageattention.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
copying sageattention\core.py -> build\lib.win-amd64-cpython-312\sageattention
copying sageattention\fa3_wrapper.py -> build\lib.win-amd64-cpython-312\sageattention
copying sageattention\quant.py -> build\lib.win-amd64-cpython-312\sageattention
copying sageattention\sm80_compile.py -> build\lib.win-amd64-cpython-312\sageattention
copying sageattention\sm89_compile.py -> build\lib.win-amd64-cpython-312\sageattention
copying sageattention\sm90_compile.py -> build\lib.win-amd64-cpython-312\sageattention
copying sageattention_init_.py -> build\lib.win-amd64-cpython-312\sageattention
copying sageattention\triton\attn_qk_int8_block_varlen.py -> build\lib.win-amd64-cpython-312\sageattention\triton
copying sageattention\triton\attn_qk_int8_per_block.py -> build\lib.win-amd64-cpython-312\sageattention\triton
copying sageattention\triton\attn_qk_int8_per_block_causal.py -> build\lib.win-amd64-cpython-312\sageattention\triton
copying sageattention\triton\attn_qk_int8_per_block_causal_varlen.py -> build\lib.win-amd64-cpython-312\sageattention\triton
copying sageattention\triton\quant_per_block.py -> build\lib.win-amd64-cpython-312\sageattention\triton
copying sageattention\triton\quant_per_block_varlen.py -> build\lib.win-amd64-cpython-312\sageattention\triton
copying sageattention\triton\quant_per_thread.py -> build\lib.win-amd64-cpython-312\sageattention\triton
copying sageattention\triton_init_.py -> build\lib.win-amd64-cpython-312\sageattention\triton
running build_ext
W1202 18:13:09.983000 28948 venv\Lib\site-packages\torch\utils\cpp_extension.py:480] Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
building 'sageattention.qattn_sm80' extension
building 'sageattention.qattn_sm89' extension
building 'sageattention.fused' extension
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\bin\nvcc" -c csrc/fused/fused.cu -o build\temp.win-amd64-cpython-312\Release\sageattention.fused\csrc/fused/fused.obj -IE:\SageAttention\venv\Lib\site-packages\torch\include -IE:\SageAttention\venv\Lib\site-packages\torch\include\torch\csrc\api\include "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\include" -IE:\SageAttention\venv\include -IC:\Users\22129\AppData\Local\Programs\Python\Python312\include -IC:\Users\22129\AppData\Local\Programs\Python\Python312\Include -Xcompiler /EHsc -Xcompiler /wd4068 -Xcompiler /wd4067 -Xcompiler /wd4624 -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -D__CUDA_NO_HALF_OPERATORS
-D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -O3 -std=c++17 -U__CUDA_NO_HALF_OPERATORS__ -U__CUDA_NO_HALF_CONVERSIONS__ --use_fast_math --threads=8 -Xptxas=-v -diag-suppress=174 --threads 8 -D_GLIBCXX_USE_CXX11_ABI=1 -gencode arch=compute_120a,code=sm_120a -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_fused -std=c++17 --use-local-env
cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IE:\SageAttention\venv\Lib\site-packages\torch\include -IE:\SageAttention\venv\Lib\site-packages\torch\include\torch\csrc\api\include "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\include" -IE:\SageAttention\venv\include -IC:\Users\22129\AppData\Local\Programs\Python\Python312\include -IC:\Users\22129\AppData\Local\Programs\Python\Python312\Include /EHsc /Tpcsrc/qattn/pybind_sm80.cpp /Fobuild\temp.win-amd64-cpython-312\Release\sageattention._qattn_sm80\csrc/qattn/pybind_sm80.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc -g -O3 -fopenmp -lgomp -std=c++17 -DENABLE_BF16 -D_GLIBCXX_USE_CXX11_ABI=1 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_fused /std:c++17
cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IE:\SageAttention\venv\Lib\site-packages\torch\include -IE:\SageAttention\venv\Lib\site-packages\torch\include\torch\csrc\api\include "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0\include" -IE:\SageAttention\venv\include -IC:\Users\22129\AppData\Local\Programs\Python\Python312\include -IC:\Users\22129\AppData\Local\Programs\Python\Python312\Include /EHsc /Tpcsrc/qattn/pybind_sm89.cpp /Fobuild\temp.win-amd64-cpython-312\Release\sageattention._qattn_sm89\csrc/qattn/pybind_sm89.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc -g -O3 -fopenmp -lgomp -std=c++17 -DENABLE_BF16 -D_GLIBCXX_USE_CXX11_ABI=1 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_fused /std:c++17
nvcc fatal : Cannot find compiler 'cl.exe' in PATH
error: command 'cl.exe' failed: None
(venv) PS E:\SageAttention>
(venv) PS E:\SageAttention> # 或者使用 pip 安装(推荐)
(venv) PS E:\SageAttention> pip install -e .
Obtaining file:///E:/SageAttention
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... error
error: subprocess-exited-with-error

× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
Traceback (most recent call last):
File "E:\SageAttention\venv\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 389, in
main()
File "E:\SageAttention\venv\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 373, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\SageAttention\venv\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 157, in get_requires_for_build_editable
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\22129\AppData\Local\Temp\pip-build-env-xdwewd82\overlay\Lib\site-packages\setuptools\build_meta.py", line 464, in get_requires_for_build_editable
return self.get_requires_for_build_wheel(config_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\22129\AppData\Local\Temp\pip-build-env-xdwewd82\overlay\Lib\site-packages\setuptools\build_meta.py", line 332, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\22129\AppData\Local\Temp\pip-build-env-xdwewd82\overlay\Lib\site-packages\setuptools\build_meta.py", line 302, in _get_build_requires
self.run_setup()
File "C:\Users\22129\AppData\Local\Temp\pip-build-env-xdwewd82\overlay\Lib\site-packages\setuptools\build_meta.py", line 318, in run_setup
exec(code, locals())
File "", line 36, in
ModuleNotFoundError: No module named 'torch'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip is available: 25.0.1 -> 25.3
[notice] To update, run: python.exe -m pip install --upgrade pip
error: subprocess-exited-with-error

× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
(venv) PS E:\SageAttention>
(venv) PS E:\SageAttention>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions