Installation#
Prerequisites: Linux · Python 3.10–3.14 · NVIDIA GPU (compute 7.0+) · CUDA 12.1+ · uv
Install LMCache#
For guidance on choosing a vLLM release, LMCache release channel, and native runtime, see vLLM and LMCache compatibility before installing.
uv venv --python 3.12
source .venv/bin/activate
uv pip install lmcache
Important
You’re all set! You can now start using LMCache. For hands-on guides and more usage examples, see the Quickstart guide.
Note
NIXL support (e.g. for disaggregated prefill and P2P KV sharing) is an optional extra:
uv pip install lmcache[nixl]
The ROCm wheel targets AMD Instinct gfx942 (MI300X / MI325X) and
gfx950 (MI350X / MI355X) in one fat binary, and is ABI-matched to the
upstream vllm/vllm-openai-rocm image (torch 2.13, Python 3.12).
It is published to a dedicated
GitHub Release rather than PyPI.
Install directly inside an upstream vLLM ROCm container — torch and the
ROCm runtime are already present, so --no-deps binds against them:
docker run -it --device /dev/kfd --device /dev/dri \
--group-add video --security-opt seccomp=unconfined \
--entrypoint bash vllm/vllm-openai-rocm:v0.32.0
VERSION=0.5.3 # replace with target release
pip install lmcache==${VERSION}+rocm7.2 --no-deps \
--find-links https://github.com/LMCache/LMCache/releases/expanded_assets/v${VERSION}-rocm
Note
The wheel excludes torch and the ROCm runtime libraries (they bind to the host image at runtime). Match the wheel’s minor torch/ROCm version to your container; for other bases, use the From Source tab.
Note
The ROCm wheel carries a +rocm7.2 PEP 440 local version, so
pip show lmcache reports which build is installed and the ROCm
build can be requested explicitly. A bare lmcache==${VERSION}
also resolves it, since == ignores the local segment.
The Intel XPU wheel is ABI-matched to the upstream
vllm/vllm-openai-xpu:latest image.
It is published to a dedicated
GitHub Release rather than PyPI.
Install directly inside the matching upstream vLLM XPU container. Torch and the
oneAPI/SYCL runtime are already present, so --no-deps preserves that runtime stack:
docker run -it --device /dev/dri --shm-size=4g \
--entrypoint bash vllm/vllm-openai-xpu:latest
VERSION=0.5.7 # use an XPU release built for latest vLLM
pip install lmcache==${VERSION}+xpu --no-deps \
--no-index \
--find-links https://github.com/LMCache/LMCache/releases/expanded_assets/v${VERSION}-xpu
Note
The wheel excludes torch and oneAPI/SYCL runtime libraries, which bind to the host image at runtime. Match the wheel’s torch and oneAPI versions to the container; for other bases, use the From Source tab.
--no-index restricts pip to the GitHub Release asset, preventing it from
selecting a same-version CUDA wheel from PyPI.
Note
The XPU wheel carries a +xpu PEP 440 local version, so
pip show lmcache reports which build is installed and the XPU
build can be requested explicitly. A bare lmcache==${VERSION}
also resolves it, since == ignores the local segment.
The MUSA wheel is built in the validated TorchMUSA/MUSA SDK image used by the release workflow and is published to a dedicated GitHub Release. It is not uploaded to PyPI because TorchMUSA is distributed by Moore Threads rather than the public PyPI index.
Start a matching MUSA runtime image. The image must provide
torch_musa, the MUSA SDK libraries, and (for the native
transfer fast path) musa_aiter:
docker run -it --privileged --network=host \
-e MTHREADS_VISIBLE_DEVICES=all \
--entrypoint bash \
sh-harbor.mthreads.com/ai-kv/kuae-lmcache-vllm-ci@sha256:75c8c1012cf49caf6dd99dbbfd33931ef100d035647083b999eaf0092d94edba
VERSION=0.5.5 # replace with target release
pip install lmcache==${VERSION}+musa --no-deps \
--no-index \
--find-links https://github.com/LMCache/LMCache/releases/expanded_assets/v${VERSION}-musa
Note
--no-deps is required: it preserves the image’s
vendor-pinned TorchMUSA stack instead of resolving the
generic torch dependency from PyPI. --no-index
prevents pip from selecting a same-version CUDA wheel.
The current MUSA profile ships LMCache’s Python MUSA
integration and common native modules. MUSA-specific
fused kernels remain supplied by the optional
musa_aiter package; build from source if your
vendor image uses a different native extension.
Note
The wheel carries a +musa PEP 440 local version,
so pip show lmcache identifies the accelerator
variant. A bare lmcache==${VERSION} also matches
this wheel, but the explicit local version avoids
accidentally selecting the CUDA artifact.
This wheel targets AMD Instinct gfx942 (MI300X / MI325X) and
gfx950 (MI350X / MI355X). It is built and smoke-tested in the
public AMD PyTorch image
rocm/pytorch:rocm7.2.4_ubuntu24.04_py3.12_pytorch_release_2.10.0
pinned at digest
sha256:4449f856653602317e4101a76fce599c7fcd58ccec2e539951fce5f73083179e.
It does not require the ATOM image.
The supported ABI tuple is exact:
AMD wheel source: torch-2.10.0+rocm7.2.4.lw.git3d3aa833-cp312-cp312-linux_x86_64.whl
torch runtime version:
2.10.0+rocm7.2.4.git3d3aa833(git3d3aa833db84eed6b7f5595cb5f162c2f78300a4)ROCm
7.2.4with HIP runtime7.2.53211Python/platform tag:
cp312-cp312-manylinux_2_39_x86_64C++ ABI:
_GLIBCXX_USE_CXX11_ABI=1
Install the matching wheel inside that pinned image:
docker run -it --device /dev/kfd --device /dev/dri \
--group-add video --security-opt seccomp=unconfined \
--entrypoint bash \
rocm/pytorch:rocm7.2.4_ubuntu24.04_py3.12_pytorch_release_2.10.0@sha256:4449f856653602317e4101a76fce599c7fcd58ccec2e539951fce5f73083179e
VERSION=0.5.4 # replace with target release
pip install \
lmcache==${VERSION}+rocm7.2.4.torch2.10.git3d3aa833.cxx11abi1 \
--no-deps \
--find-links https://github.com/LMCache/LMCache/releases/expanded_assets/v${VERSION}-rocm-torch210
The wheel links torch and ROCm libraries from the container at runtime. Other torch 2.10, ROCm 7.2.x, Python, or C++ ABI combinations are not covered by this artifact; build from source for those environments.
The RBLN wheel targets Rebellions NPUs (CPython 3.12,
manylinux_2_34_x86_64). It is built against the torch
that torch-rbln pins and is published to a dedicated
GitHub Release;
each release’s notes name the torch-rbln version it targets.
It is not uploaded to PyPI, whose lmcache wheel is built
against the CUDA torch.
Install the RBLN runtime stack (torch-rbln and
rebel-compiler) by following the
RBLN SDK documentation, then install
the wheel into that environment:
VERSION=X.Y.Z # target LMCache release
pip install lmcache==${VERSION}+rbln \
--find-links https://github.com/LMCache/LMCache/releases/expanded_assets/v${VERSION}-rbln
Note
LMCache’s torch dependency is unpinned, so pip keeps the
torch that torch-rbln installed and resolves only the
other dependencies from PyPI. The +rbln local version is
an exact pin that only the RBLN release satisfies.
The wheel’s C++ extensions link libtorch, so it works only
with the torch-rbln release its notes name. For other
versions, build from source as described in
Rebellions NPU.
Nightly wheels are built from the latest dev branch each day at 07:30 UTC
and published to GitHub Releases. No version pinning required — --pre
picks the latest nightly automatically.
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
Run inside an upstream vLLM ROCm container so torch and the ROCm
runtime are already present, then install with --no-deps:
docker run -it --device /dev/kfd --device /dev/dri \
--group-add video --security-opt seccomp=unconfined \
--entrypoint bash vllm/vllm-openai-rocm:v0.26.0
pip install lmcache --pre --no-deps --no-index \
--find-links https://github.com/LMCache/LMCache/releases/expanded_assets/nightly-rocm
Nightly ROCm wheels are versioned like the CUDA nightlies with the
ROCm local segment appended, e.g. 0.5.4.dev15+rocm7.2.
Note
--no-index is required here. --find-links only adds a
source, so without it pip also considers PyPI — and under PEP 440 a
pre-release such as 0.5.4rc4 outranks 0.5.4.dev15+rocm7.2, so
--pre would install the CUDA wheel instead. The stable tab does
not need it because lmcache==${VERSION}+rocm7.2 is an exact pin
that only the ROCm release can satisfy. --no-deps is what makes
--no-index safe here: torch and the ROCm runtime come from the
container, so nothing else needs resolving.
--no-build-isolation ensures the kernels are compiled against the same torch
already installed in your environment, preventing undefined symbol errors at runtime.
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
# Need to install these packages manually to avoid build isolation
uv pip install -r requirements/build.txt
# Install torch from the ROCm wheel index. Pin the torch minor to
# match the upstream vllm/vllm-openai-rocm image (torch 2.13).
uv pip install "torch==2.13.0+rocm7.2" torchvision --index-url https://download.pytorch.org/whl/rocm7.2
# 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
Build in the Python environment that already provides vLLM,
XPU torch, and the matching oneAPI/SYCL runtime. The upstream
runtime image does not include the DPC++ compiler. If icpx
is missing, the helper below installs a compiler matching the
installed runtime without upgrading it. Run the helper as root
in the container, or with sudo on a host.
For intel-sycl-rt, it prefers an exact compiler release,
falling back to the newest available patch not newer than the
runtime within the same major/minor release. A dpkg-managed
runtime still requires an exact package version match.
docker run -it --device /dev/dri --shm-size=4g \
--entrypoint bash vllm/vllm-openai-xpu:latest
git clone https://github.com/LMCache/LMCache.git
cd LMCache
uv pip install -r requirements/build.txt
if [ -f /opt/intel/oneapi/setvars.sh ]; then
source /opt/intel/oneapi/setvars.sh
fi
if ! command -v icpx >/dev/null 2>&1; then
PYTHON="$(command -v python3)" \
bash .buildkite/k3_tests/xpu/install_xpu_dpcpp_compiler.sh
source /opt/intel/oneapi/setvars.sh
fi
BUILD_WITH_SYCL=1 uv pip install --no-build-isolation -e .
MACA is CUDA-compatible: a MACA-enabled torch build reports
device.type == "cuda", so LMCache’s existing CUDA-compatible
connector path works without a separate device backend. There is no
prebuilt MACA wheel or CI build – this is a self-compile-only path,
built with a MACA-enabled torch already installed via MetaX’s own
toolchain (not from PyPI).
# Puts the MACA SDK's cu-bridge nvcc-compatible compiler on PATH
# and its runtime libs on LD_LIBRARY_PATH -- required before the
# build step below, so torch.utils.cpp_extension can locate it.
# Adjust MACA_PATH to your actual MACA SDK install root.
export MACA_PATH=/opt/maca
export CUCC_PATH=${MACA_PATH}/tools/cu-bridge
export PATH=${CUCC_PATH}/bin:${CUCC_PATH}/tools:${MACA_PATH}/mxgpu_llvm/bin:${MACA_PATH}/bin:${PATH}
export LD_LIBRARY_PATH=${MACA_PATH}/lib:${MACA_PATH}/mxgpu_llvm/lib:${MACA_PATH}/ompi/lib:${LD_LIBRARY_PATH}
git clone https://github.com/LMCache/LMCache.git
cd LMCache
# Assumes a MACA-enabled torch is already installed/active in this
# environment (e.g. inside a vllm-metax container).
# Need to install these packages manually to avoid build isolation
pip install -r requirements/build.txt
# --no-deps skips install_requires entirely, including
# requirements/common.txt's cufile-python/nvtx (NVIDIA-only,
# not needed on MACA) and the unpinned generic "torch" entry
# (which would otherwise risk resolving over the MACA build).
# Install any other runtime deps you actually need yourself first --
# MP mode needs mcpy (MetaX's cupy equivalent), published on MetaX's
# own pip index rather than PyPI:
# pip install mcpy -i https://repos.metax-tech.com/r/maca-pypi/simple \
# --trusted-host repos.metax-tech.com
# SETUPTOOLS_SCM_PRETEND_VERSION makes the wheel filename and
# lmcache.__version__ carry the MACA build identity (mirrors how
# torch's own ROCm wheels are named e.g. torch-2.11.0+rocm7.2-...).
# Derives the base version from this checkout's own git tag (so
# it never needs manual updates across releases) and appends a
# +maca<build> local segment -- set MACA_AI_VERSION to your MACA
# SDK/build number, or leave it at the default below.
BASE_VERSION=$(python -m setuptools_scm)
SETUPTOOLS_SCM_PRETEND_VERSION="${BASE_VERSION}+maca${MACA_AI_VERSION:-0.0.0.0}" \
BUILD_WITH_MACA=1 pip install --no-deps --no-build-isolation -e .
docker pull lmcache/vllm-openai
docker pull lmcache/vllm-openai:latest-nightly
The nightly image follows vLLM main, which is built
with CUDA 13.2. The host needs NVIDIA driver 595.45.04
or newer, the driver NVIDIA lists for CUDA 13.2 in the
CUDA Toolkit release notes;
install it on the host. On a 580.x driver, some
models fail to load with the provided PTX was
compiled with an unsupported toolchain.
docker pull lmcache/sglang
The official SGLang release image with the matching LMCache
wheel installed (CUDA 13.0). SGLang supports only MP mode, so
run it with --enable-lmcache against a separate LMCache
server, such as lmcache/standalone.
docker pull rocm/vllm-dev:nightly_0624_rc2_0624_rc2_20250620
docker pull vllm/vllm-openai-xpu:latest
The official CUDA vLLM and standalone images default to the non-root
lmcache user (uid 1000). Mount the Hugging Face cache at
/home/lmcache/.cache/huggingface; existing volumes and bind mounts
must be writable by that uid.
See Docker deployment for running the container and ROCm images.
Lightweight CLI-only package for querying or benchmarking a remote LMCache server. No CUDA required, works on any OS.
pip install lmcache-cli
Note
lmcache-cli and lmcache ship the same lmcache CLI command.
Do not install both in the same environment.
Build the Docker Image#
Instead of pulling a prebuilt image, you can build the LMCache (integrated with vLLM) image yourself from the provided Dockerfile, located in docker/.
From the root of the LMCache repository:
docker build --tag <IMAGE_NAME>:<TAG> --target image-build --file docker/Dockerfile .
Replace <IMAGE_NAME> and <TAG> with your desired image name and tag. See
the example build file in docker/
for an explanation of all build arguments.
Verify Installation#
python -c "import lmcache.cuda_ops"