Description
Prerequisites
Please answer the following questions for yourself before submitting an issue.
- [ X] I am running the latest code. Development is very rapid so there are no tagged versions as of now.
- [ X] I carefully followed the README.md.
- [ X] I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
- [X ] I reviewed the Discussions, and have a new bug or useful enhancement to share.
Expected Behavior
Attempting to install llama-cpp-python on Win11 and run it w/GPU enabled by using the following in powershell:
conda create --name Dingo python==3.9.19 pytorch torchvision torchaudio pytorch-cuda==11.8 -c pytorch -c nvidia -y
conda activate Dingo
$env:CMAKE_ARGS="-DLLAMA_CUDA=on"
$env:CUDATOOLKITDIR="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2"
$env:FORCE_CMAKE=1
pip install llama-cpp-python --no-cache-dir --force-reinstall --verbose
Current Behavior
Currently not able to build the wheel for llama-cpp-python - Log below. I have successfully progressed through other debugging steps (e.g. CUDA Toolkit not found) but this particular error revolving around CMAKE_DETERMINE_COMPILER_ID_BUILD has been a total bear. Have shifted the relevant four Cuda files to the VSC repo, reinstalled vsc/cmake/gcc, and tried CUDA versions 11.7-11.8, 12.0, 12.2.
Environment and Context
winver -> Windows 11 23H2 (22631.3447)
conda --version -> conda 24.1.2
pip --version -> pip 23.3.1
python --version -> python 3.9.19
cmake --version -> cmake version 3.29.2
gcc --version -> gcc.exe (Rev3, Built by MSYS2 project) 13.2.0
nvidia-smi ->
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 536.25 Driver Version: 536.25 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 3070 ... WDDM | 00000000:01:00.0 On | N/A |
| N/A 58C P8 23W / 138W | 598MiB / 8192MiB | 4% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
Failure Logs
Building wheels for collected packages: llama-cpp-python
Running command Building wheel for llama-cpp-python (pyproject.toml)
*** scikit-build-core 0.9.1 using CMake 3.29.2 (wheel)
*** Configuring CMake...
2024-04-20 13:58:20,744 - scikit_build_core - WARNING - Can't find a Python library, got libdir=None, ldlibrary=None, multiarch=None, masd=None
loading initial cache file C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeInit.txt
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.39.33523.0
-- The CXX compiler identification is MSVC 19.39.33523.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.41.0.windows.3")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/include (found version "12.2.91")
-- CUDA found
CMake Error at C:/Users/Thatsme/AppData/Local/Temp/pip-build-env-ufodkd12/normal/Lib/site-packages/cmake/data/share/cmake-3.29/Modules/CMakeDetermineCompilerId.cmake:814 (message):
Compiling the CUDA compiler identification source file
"CMakeCUDACompilerId.cu" failed.
Compiler:
Build flags:
Id flags: --keep;--keep-dir;tmp -v
The output was:
1
MSBuild version 17.9.8+b34f75857 for .NET Framework
Build started 4/20/2024 1:58:28 PM.
Project "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA.vcxproj"
on node 1 (default targets).
PrepareForBuild:
Creating directory "Debug\".
C:\Program Files\Microsoft Visual
Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5):
warning MSB8029: The Intermediate directory or Output directory cannot
reside under the Temporary directory as it could lead to issues with
incremental build. [C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://aka.ms/cpp/structured-output for more details.
Creating directory "Debug\CompilerIdCUDA.tlog\".
InitializeBuildStatus:
Creating "Debug\CompilerIdCUDA.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
Touching "Debug\CompilerIdCUDA.tlog\unsuccessfulbuild".
AddCudaCompileDeps:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64\cl.exe /E /nologo /showIncludes /TP /D__CUDACC__ /D__CUDACC_VER_MAJOR__=12 /D__CUDACC_VER_MINOR__=2 /D_MBCS /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\bin" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include" /I. /FIcuda_runtime.h /c "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CMakeCUDACompilerId.cu"
Project "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA.vcxproj"
(1) is building "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA.vcxproj"
(1:2) on node 1 (CudaBuildCore target(s)).
CudaBuildCore:
Compiling CUDA source file CMakeCUDACompilerId.cu...
Creating directory "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA\x64\Debug".
cmd.exe /C "C:\Users\Thatsme\AppData\Local\Temp\tmp3adc6f89e6574352bcb8d48d65baa9ff.cmd"
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include" -G --keep-dir CompilerIdCUDA\x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FS /Zi /RTC1 /MDd " -Xcompiler "/FdDebug\vc143.pdb" -o "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA\x64\Debug\CMakeCUDACompilerId.cu.obj" "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CMakeCUDACompilerId.cu"
C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include" -G --keep-dir CompilerIdCUDA\x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FS /Zi /RTC1 /MDd " -Xcompiler "/FdDebug\vc143.pdb" -o "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA\x64\Debug\CMakeCUDACompilerId.cu.obj" "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CMakeCUDACompilerId.cu"
C:\Program Files\Microsoft Visual
Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA
12.2.targets(799,9): error MSB3721: The command ""C:\Program Files\NVIDIA
GPU Computing Toolkit\CUDA\v12.2\bin\nvcc.exe"
-gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin
"C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64" -x cu
-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include"
-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include" -G
--keep-dir CompilerIdCUDA\x64\Debug -maxrregcount=0 --machine 64 --compile
-cudart static -v -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FS /Zi
/RTC1 /MDd " -Xcompiler "/FdDebug\vc143.pdb" -o "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA\x64\Debug\CMakeCUDACompilerId.cu.obj"
"C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CMakeCUDACompilerId.cu""
exited with code 1. [C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
Done Building Project "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA.vcxproj"
(CudaBuildCore target(s)) -- FAILED.
Done Building Project "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA.vcxproj"
(default targets) -- FAILED.
Build FAILED.
"C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA.vcxproj"
(default target) (1) ->
(PrepareForBuild target) ->
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
"C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA.vcxproj"
(default target) (1) ->
"C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA.vcxproj"
(CudaBuildCore target) (1:2) ->
(CudaBuildCore target) ->
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.2.targets(799,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2\include" -G --keep-dir CompilerIdCUDA\x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FS /Zi /RTC1 /MDd " -Xcompiler "/FdDebug\vc143.pdb" -o "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA\x64\Debug\CMakeCUDACompilerId.cu.obj" "C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CMakeCUDACompilerId.cu"" exited with code 1. [C:\Users\Thatsme\AppData\Local\Temp\tmp8hlz1fed\build\CMakeFiles\3.29.2\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.04
Call Stack (most recent call first):
C:/Users/Thatsme/AppData/Local/Temp/pip-build-env-ufodkd12/normal/Lib/site-packages/cmake/data/share/cmake-3.29/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
C:/Users/Thatsme/AppData/Local/Temp/pip-build-env-ufodkd12/normal/Lib/site-packages/cmake/data/share/cmake-3.29/Modules/CMakeDetermineCompilerId.cmake:53 (__determine_compiler_id_test)
C:/Users/Thatsme/AppData/Local/Temp/pip-build-env-ufodkd12/normal/Lib/site-packages/cmake/data/share/cmake-3.29/Modules/CMakeDetermineCUDACompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
vendor/llama.cpp/CMakeLists.txt:408 (enable_language)
-- Configuring incomplete, errors occurred!
*** CMake configuration failed
error: subprocess-exited-with-error
× Building wheel for llama-cpp-python (pyproject.toml) 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.
full command: 'C:\Users\Thatsme\.conda\envs\Athena\python.exe' 'C:\Users\Thatsme\.conda\envs\Athena\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' build_wheel 'C:\Users\Thatsme\AppData\Local\Temp\tmp6oisyidr'
cwd: C:\Users\Thatsme\AppData\Local\Temp\pip-install-lax5oior\llama-cpp-python_fc76770a1f674cdebd8ede0dc231e448
Building wheel for llama-cpp-python (pyproject.toml) ... error
ERROR: Failed building wheel for llama-cpp-python
Failed to build llama-cpp-python