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