Latest llama.cpp won't build in Spaces

I have the requirements (CPU Upgrade instance):


cmake==4.0.3
llama_cpp_python==0.3.15
gradio==5.34.2
pypdf==5.9.0
python-docx==1.2.0
pandas==2.3.0

When this space builds: 3B Param Basic Chatbot - a Hugging Face Space by david-thrower , the space will get “stuck“ building the wheel for llama.cpp without any feedback in the logs on what is going on:


Building wheels for collected packages: llama_cpp_python
  Building wheel for llama_cpp_python (pyproject.toml): started
# ... never prints another line then a "build error" with no further info 

I have tried numerous attempts to troubleshoot this:

  1. Adding cmake==4.0.3 to the requirements.
  2. Setting the environment variables: FORCE_CMAKE=1; CMAKE_ARGS=”-DLLAMA_OPENBLAS=on”'; PIP_NO_CACHE_DIR=1
  3. Nothing seems to fix the problem

The is working like a charm on my laptop (albeit building that wheel did take a few minutes).

1 Like

I tried it as a last resort, and it worked.

app.py

import subprocess
subprocess.run("pip install -V llama_cpp_python==0.3.15", shell=True)

...

requirements.txt

#cmake==4.0.3
#llama_cpp_python==0.3.15
#gradio==5.34.2
pypdf==5.9.0
python-docx==1.2.0
pandas==2.3.0