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

I don’t know, how it is working for you but I am also facing this issue.

logs:

Collecting llama_cpp_python==0.3.15
  Downloading llama_cpp_python-0.3.15.tar.gz (50.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 50.6/50.6 MB 68.6 MB/s  0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: typing-extensions>=4.5.0 in /usr/local/lib/python3.13/site-packages (from llama_cpp_python==0.3.15) (4.15.0)
Requirement already satisfied: numpy>=1.20.0 in /usr/local/lib/python3.13/site-packages (from llama_cpp_python==0.3.15) (2.4.1)
Collecting diskcache>=5.6.1 (from llama_cpp_python==0.3.15)
  Downloading diskcache-5.6.3-py3-none-any.whl.metadata (20 kB)
Requirement already satisfied: jinja2>=2.11.3 in /usr/local/lib/python3.13/site-packages (from llama_cpp_python==0.3.15) (3.1.6)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.13/site-packages (from jinja2>=2.11.3->llama_cpp_python==0.3.15) (3.0.3)
Downloading diskcache-5.6.3-py3-none-any.whl (45 kB)
Building wheels for collected packages: llama_cpp_python
  Building wheel for llama_cpp_python (pyproject.toml): started
  Building wheel for llama_cpp_python (pyproject.toml): still running...

# No progress after this

app.py

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

1 Like

There are cases where that method doesn’t work. In those cases, the most reliable approach is to fork GitHub yourself, create a build wheel, and publish it (though you can certainly use a build wheel created by someone else). But it’s a real pain…

1 Like