How to install the latest version with GPU support
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 65/100
- Issue 類型
- 文件
- 描述清晰度
- 描述清楚
- 活躍度
- 冷清
- 技術堆疊
- cmake, docker, python
研究方向
該 issue 提供了一個用於安裝具備 GPU 支援的 llama-cpp-python 的 Dockerfile 片段。先閱讀 repository 現有的安裝文件,以了解標準流程。接著根據你的環境調整所提供的指令,並確保 CUDA 版本相容。透過執行一個針對 llama_cpp 的簡單 Python 匯入測試來驗證安裝。
由索引模型根據 Issue 內容生成。
描述
Hey, I've been struggling for a month to install the latest version with CUDA. It was a nightmare.
So here is the guide how to do that.
tldr docker syntax:
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y build-essential \
ocl-icd-opencl-dev opencl-headers clinfo \
libclblast-dev libopenblas-dev \
&& mkdir -p /etc/OpenCL/vendors \
&& echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd \
&& apt-get clean
RUN pip install uv
RUN uv init .
RUN export CC=/usr/bin/gcc CXX=/usr/bin/g++
RUN export LD_LIBRARY_PATH=/usr/lib/gcc/$(gcc -dumpmachine)/$(gcc -dumpversion):$LD_LIBRARY_PATH
RUN CMAKE_ARGS="-DGGML_CUDA=on \
-DCMAKE_CUDA_ARCHITECTURES=75 \
-DLLAMA_BUILD_EXAMPLES=OFF \
-DLLAMA_BUILD_TESTS=OFF" FORCE_CMAKE=1 \
uv pip install --system --upgrade --force-reinstall llama-cpp-python==0.3.8 \
--index-url https://pypi.org/simple \
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu122 \
--index-strategy unsafe-best-match
Explanation:
Installation for CPU is easy as a cake.
Installation from source with GPU support is slow and labour intensive, so the best way is to install using provided wheels.
Github doesn't serve the last release in wheel. Latest was 0.3.8 while github has 0.3.4. It's relatively new but doesn't support gemma3.
First we need to provide paths to gcc and g++ compilers. Somehow this is a dealbreaker.
RUN export CC=/usr/bin/gcc CXX=/usr/bin/g++
RUN export LD_LIBRARY_PATH=/usr/lib/gcc/$(gcc -dumpmachine)/$(gcc -dumpversion):$LD_LIBRARY_PATH
Linux dependencies:
apt-get install -y build-essential \
ocl-icd-opencl-dev opencl-headers clinfo \
libclblast-dev libopenblas-dev \
&& mkdir -p /etc/OpenCL/vendors \
&& echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd \
This one shortens the traceback in case anything fails. And it will fail likely.
-DLLAMA_BUILD_EXAMPLES=OFF \
-DLLAMA_BUILD_TESTS=OFF" FORCE_CMAKE=1 \
LLAMA_CUBLAS is obsolete, so we need to replace it with:
DGGML_CUDA=on
UV somehow manages to install this while pip can't.
uv pip install --system --upgrade --force-reinstall llama-cpp-python==0.3.8 \
--index-url https://pypi.org/simple \
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu122 \
--index-strategy unsafe-best-match
Here we need to provide both --index-url https://pypi.org/simple and --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu122 because otherwise either 0.3.8 either cuda support wouldn't be available to pip. Replace cu122 with your cuda version. --index-strategy unsafe-best-match is also required otherwise it didn't build.
- 主要語言
- Python
- 星號
- 10.6k
- 分支
- 1.5k
- 平均合併
- 3 小時 57 分鐘
- 30 天內合併 PR
- 4
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
abetlen/llama-cpp-python 的其他 Issue
-
Seven llama_sampler_init_* bindings admit keyword arguments that the ctypes function object silently drops可能已有人在做 @Belal0066 於 13 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 88/100
abetlen/llama-cpp-python#2371 ·
維護者通常 1 天內回覆
-
uv add llama-cpp-python wheels fails for versions above 0.3.30可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 65/100
abetlen/llama-cpp-python#2352 · 1 則留言 · 2 個 reaction ·
維護者通常 1 天內回覆
-
Docs: consolidate build-from-source and GPU backend guide可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
abetlen/llama-cpp-python#2314 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
abetlen/llama-cpp-python#2211 · 2 則留言 ·
維護者通常 1 天內回覆
-
Llama() silently accepts and discards `embedding` kwarg; .embed() then raises confusingly可能已有人在做 @Anai-Guo 於 30 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 65/100
abetlen/llama-cpp-python#2210 ·
維護者通常 1 天內回覆
查看 abetlen/llama-cpp-python 的全部 Issue
相似的 Issue
-
json_params_matcher fails on falsy top-level JSON primitives (0, False, "")可能已有人在做 @mayureshsonawane17 今天認領。 未關閉Waiting for: Product Owner
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 5 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 88/100
bojieli/ai-agent-book#1169 ·
維護者通常 1 天內回覆
-
priority:low ready-for-dev
難度 2/5 1-3 小時 新手友好度 78/100
OpenHands/extensions#738 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 85/100
micronaut-projects/micronaut-core#13677 ·
維護者通常 1 天內回覆