安装#
前提条件: Linux · Python 3.9–3.13 · NVIDIA GPU (计算 7.0+) · CUDA 12.1+ · uv
安装 LMCache#
uv venv --python 3.12
source .venv/bin/activate
uv pip install lmcache
重要
一切准备就绪!您现在可以开始使用 LMCache。有关实践指南和更多使用示例,请参阅 更多示例 部分。
CUDA 12.9 的 wheel 发布在专用的 GitHub Release 上,而不是 PyPI。
uv venv --python 3.12
source .venv/bin/activate
VERSION=0.4.3 # replace with target release
uv pip install lmcache==${VERSION} \
--extra-index-url https://download.pytorch.org/whl/cu129 \
--find-links https://github.com/LMCache/LMCache/releases/expanded_assets/v${VERSION}-cu129 \
--index-strategy unsafe-best-match
备注
--extra-index-url https://download.pytorch.org/whl/cu129 确保解析 PyTorch 的 CUDA 12.9 构建。没有它,pip 可能会选择不匹配的 CUDA 变体。
夜间构建的轮子每天在 UTC 时间 07:30 从最新的 dev 分支构建,并发布到 GitHub Releases。无需版本固定 — --pre 会自动选择最新的夜间版本。
uv venv --python 3.12
source .venv/bin/activate
uv pip install lmcache --pre \
--extra-index-url https://download.pytorch.org/whl/cu130 \
--find-links https://github.com/LMCache/LMCache/releases/expanded_assets/nightly \
--index-strategy unsafe-best-match
uv venv --python 3.12
source .venv/bin/activate
uv pip install lmcache --pre \
--extra-index-url https://download.pytorch.org/whl/cu129 \
--find-links https://github.com/LMCache/LMCache/releases/expanded_assets/nightly-cu129 \
--index-strategy unsafe-best-match
--no-build-isolation 确保内核与您环境中已安装的相同 torch 进行编译,从而防止运行时出现未定义符号错误。
git clone https://github.com/LMCache/LMCache.git
cd LMCache
uv venv --python 3.12
source .venv/bin/activate
uv pip install -r requirements/build.txt
uv pip install vllm # pulls in required torch version (cu13)
uv pip install -e . --no-build-isolation
git clone https://github.com/LMCache/LMCache.git
cd LMCache
uv venv --python 3.12
source .venv/bin/activate
uv pip install -r requirements/build.txt
# Pin vLLM (and torch) to the cu12.9 wheel index so the local
# CUDA 12 toolchain matches what the extensions are built against.
uv pip install vllm \
--extra-index-url https://download.pytorch.org/whl/cu129 \
--index-strategy unsafe-best-match
# LMCACHE_CUDA_MAJOR=12 makes setup.py pick cupy-cuda12x / nixl-cu12
# for install_requires instead of the cu13 defaults.
LMCACHE_CUDA_MAJOR=12 \
uv pip install -e . --no-build-isolation
git clone https://github.com/LMCache/LMCache.git
cd LMCache
uv venv --python 3.12
source .venv/bin/activate
# Need to install these packages manually to avoid build isolation
uv pip install -r requirements/build.txt
# Install torch from the ROCm wheel index
uv pip install torch torchvision --index-url https://download.pytorch.org/whl/rocm7.0
# Build LMCache. BUILD_WITH_HIP=1 makes setup.py pick cupy-rocm-7-0 automatically.
# PYTORCH_ROCM_ARCH selects the target GPU(s):
# gfx942 -> MI300X / MI325X
# gfx950 -> MI350X / MI355X
# Comma-separate to build a fat binary for multiple archs.
PYTORCH_ROCM_ARCH="gfx942,gfx950" \
TORCH_DONT_CHECK_COMPILER_ABI=1 \
CXX=hipcc \
BUILD_WITH_HIP=1 \
uv pip install -e . --no-build-isolation
git clone https://github.com/LMCache/LMCache.git
cd LMCache
uv venv --python 3.12
source .venv/bin/activate
# Need to install these packages manually to avoid build isolation
uv pip install -r requirements/build.txt
# Build LMCache with SYCL backend.
BUILD_WITH_SYCL=1 uv pip install --no-build-isolation -e .
docker pull lmcache/vllm-openai
docker pull lmcache/vllm-openai:latest-cu129
docker pull lmcache/vllm-openai:latest-nightly
docker pull lmcache/vllm-openai:latest-nightly-cu129
docker pull rocm/vllm-dev:nightly_0624_rc2_0624_rc2_20250620
docker pull intel/vllm:0.17.0-xpu
请参阅 Docker 部署 以获取运行容器和 ROCm 镜像的信息。
轻量级的仅限 CLI 的软件包,用于查询或基准测试远程 LMCache 服务器。无需 CUDA,适用于任何操作系统。
pip install lmcache-cli
备注
lmcache-cli 和 lmcache 提供相同的 lmcache CLI 命令。请勿在同一环境中同时安装两者。
验证安装#
python -c "import lmcache.c_ops"
兼容性矩阵#
✅ 兼容 · ❌ API 不兼容 · 🕯 torch 不匹配 (使用 --no-build-isolation)
LMCache 0.4.2 |
LMCache 0.4.1 |
LMCache 0.3.15 |
LMCache 0.3.14 |
LMCache 0.3.13 |
LMCache 0.3.12 |
LMCache 0.3.11 |
LMCache 0.3.10 |
|
|---|---|---|---|---|---|---|---|---|
vLLM 0.18.0.x |
✅ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
vLLM 0.17.1.x |
✅ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
vLLM 0.17.0.x |
✅ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
vLLM 0.16.0.x |
🕯️ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
vLLM 0.15.1.x |
🕯️ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
vLLM 0.15.0.x |
🕯️ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
vLLM 0.14.1.x |
🕯️ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
vLLM 0.14.0.x |
🕯️ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
vLLM 0.13.0.x |
🕯️ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
vLLM 0.12.0.x |
🕯️ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
vLLM 0.11.2.x |
🕯️ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
vLLM 0.11.1.x |
🕯️ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
vLLM 0.11.0.x |
🕯️ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
vLLM 0.10.2.x |
🕯️ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
vLLM 0.10.1.x |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |
🕯️ |