[Python] Cannot install llama-cpp-python due to CMake: No CMAKE_C_COMPILER found (on Windows...

Discussão em 'Python' iniciado por Stack, Agosto 7, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to install llama-cpp-python on my Windows 11 system with the following setup:

    • Python 3.11 (64-bit)
    • Visual Studio 2022 Build Tools installed (with MSVC C++ toolset)
    • CMake installed
    • Opened x64 Native Tools Command Prompt for VS 2022
    • pip version: latest
    • llama-cpp-python version: latest

    I want to install llama-cpp-python to use it in a chatbot project.

    pip install llama-cpp-python


    I also tried:


    1. pip install --upgrade llama-cpp-python --prefer-binary --extra-index-url https://jllllll.github.io/llama-cpp-python-cuBLAS-wheels/AVX2/


    2. Double-checked multiple times to ensure Visual Studio installation is complete


    3. Used where cl and where cmake to verify if the commands are available


    4. Ran the terminal as Administrator


    5. Tried repairing Visual Studio via VS Installer

    What I keep getting:

    Collecting llama-cpp-python
    Using cached llama_cpp_python-0.3.14.tar.gz (51.0 MB)
    Installing build dependencies ... done
    Getting requirements to build wheel ... done
    Preparing metadata (pyproject.toml) ... done
    Collecting typing-extensions>=4.5.0 (from llama-cpp-python)
    Using cached typing_extensions-4.14.1-py3-none-any.whl.metadata (3.0 kB)
    Collecting numpy>=1.20.0 (from llama-cpp-python)
    Using cached numpy-2.2.6-cp310-cp310-win_amd64.whl.metadata (60 kB)
    Collecting diskcache>=5.6.1 (from llama-cpp-python)
    Using cached diskcache-5.6.3-py3-none-any.whl.metadata (20 kB)
    Collecting jinja2>=2.11.3 (from llama-cpp-python)
    Using cached jinja2-3.1.6-py3-none-any.whl.metadata (2.9 kB)
    Collecting MarkupSafe>=2.0 (from jinja2>=2.11.3->llama-cpp-python)
    Using cached MarkupSafe-3.0.2-cp310-cp310-win_amd64.whl.metadata (4.1 kB)
    Using cached diskcache-5.6.3-py3-none-any.whl (45 kB)
    Using cached jinja2-3.1.6-py3-none-any.whl (134 kB)
    Using cached MarkupSafe-3.0.2-cp310-cp310-win_amd64.whl (15 kB)
    Using cached numpy-2.2.6-cp310-cp310-win_amd64.whl (12.9 MB)
    Using cached typing_extensions-4.14.1-py3-none-any.whl (43 kB)
    Building wheels for collected packages: llama-cpp-python
    Building wheel for llama-cpp-python (pyproject.toml) ... error
    error: subprocess-exited-with-error

    × Building wheel for llama-cpp-python (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [20 lines of output]
    *** scikit-build-core 0.11.5 using CMake 4.0.3 (wheel)
    *** Configuring CMake...
    2025-08-07 01:14:35,666 - 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\28007\AppData\Local\Temp\tmpfjmm31n2\build\CMakeInit.txt
    -- Building for: Visual Studio 17 2022
    -- The C compiler identification is unknown
    -- The CXX compiler identification is unknown
    CMake Error at CMakeLists.txt:3 (project):
    No CMAKE_C_COMPILER could be found.



    CMake Error at CMakeLists.txt:3 (project):
    No CMAKE_CXX_COMPILER could be found.



    -- Configuring incomplete, errors occurred!

    *** CMake configuration failed
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for llama-cpp-python
    Failed to build llama-cpp-python
    error: failed-wheel-build-for-install

    × Failed to build installable wheels for some pyproject.toml based projects
    ╰─> llama-cpp-python


    How can I resolve this issue?
    Do I need to configure anything else manually?

    Continue reading...

Compartilhe esta Página