This fork adds a GitHub Actions CI workflow that builds a Windows x64 CUDA 12.6
wheel of llama-cpp-python with
CUDA DLLs pre-packaged inside the wheel (no CUDA toolkit install needed on the
consumer side). Upstream paused Windows CUDA wheels in July 2025 (see
abetlen#1543 and #2136) after -allow-unsupported-compiler
shipped wheels that segfaulted at runtime; this fork reactivates the Windows
CUDA path for our own use with a smoke-test publish gate that structurally
prevents the same failure mode.
The only deliverable here is the Windows CUDA wheel on the
Releases page —
there is no PyPI publish, no PEP 503 pip index on GitHub Pages, no support
for Linux/macOS (upstream still ships those). For the upstream Python API
documentation, see README.upstream.md.
Prerequisites. You need:
-
Windows x64
-
Python 3.11 (matches the published wheel's
cp311tag) -
NVIDIA driver ≥ 561.17 (the driver that ships with CUDA 12.6.3). Check with:
nvidia-smiThe first line of output reports your driver version; anything ≥
561.17is supported. CUDA 12.x minor-version compatibility technically works as low as527.41, but561.17is the safe figure that matches the build toolchain.
Install steps — manual download from the Releases page.
-
Go to https://github.com/ThongvanAlexis/llama-cpp-python/releases and pick the latest
v<version>-cu126-wintag. -
Download the
.whlmatching your Python version (e.g.llama_cpp_python-0.3.20+cu126.ll<sha>-cp311-cp311-win_amd64.whl). -
Install by pointing
pip installat the local path to the downloaded wheel:pip install path\to\llama_cpp_python-0.3.20+cu126.ll<sha>-cp311-cp311-win_amd64.whl -
Verify:
python -c "from llama_cpp import Llama; print('ok')"No DLL-load error means the CUDA DLLs inside the wheel were loaded correctly and you're ready to inference.
The CI pipeline is a 4-stage workflow in
.github/workflows/build-wheels-cuda-windows.yaml:
- Preflight — MSVC toolset auto-selected from the runner's installed
versions against a CUDA/
_MSC_VERcompatibility matrix;nvccandcl.exeversions asserted against the dispatchedcuda_version/ expected cap.-allow-unsupported-compileris banned (grep-assert) because it's the upstream segfault trap (#1543). - Build — scikit-build-core invokes CMake with Ninja, sccache, and
/Z7debug info; produces a correctly-tagged wheel with the 12-charllama.cppsubmodule SHA embedded in the version string for reproducibility. Size-bounded under 400 MiB. - Smoke-test — a fresh
windows-2022runner with sparse checkout (nollama_cpp/source) installs the wheel, assertsimport llama_cppresolves tosite-packages, checks CUDA architectures inggml-cuda.dllviacuobjdump, and loads a 27 KB tiny-llama GGUF. Publish is structurally gated on this job passing (needs: [build, smoke-test]), enforced by a lint-workflow grep-assert so removal is a detectable regression. - Publish — on green smoke-test only, the wheel is uploaded as a
GitHub Release asset at tag
v<base_version>-cu126-winwith a forensics body recording the llama.cpp SHA, MSVC toolset, CUDA version, wheel size and SHA-256, and the dispatch run URL.
See the workflow file for the authoritative source.
Upstream project:
github.com/abetlen/llama-cpp-python.
The original upstream README (824 lines of Python API documentation,
OpenAI/LangChain integration examples, Docker usage, server modes) is
preserved byte-for-byte at README.upstream.md for
reference.
Same MIT license as upstream — see LICENSE.md.