Buckets:

hf-doc-build/doc-dev / kernels /pr_608 /en /installation.md
|
download
raw
2.12 kB

Installation

kernels has not reached 1.0 yet. Until then, minor releases may contain breaking changes. If you depend on kernels in a library or application, we strongly recommend pinning a version range rather than an unbounded dependency. For example, in pyproject.toml:

dependencies = [
    "kernels>=0.15,<0.16",
]

or equivalently kernels~=0.15 (compatible release). This protects your project from unexpected breakage when a new kernels version is released.

Install the kernels package with pip (requires torch>=2.5 and CUDA):

pip install kernels

or with uv

uv pip install kernels

or if you want the latest version from the main branch:

pip install "kernels[benchmark] @ git+https://github.com/huggingface/kernels#subdirectory=kernels"

Curated installations

Some kernels rely on additional packages at runtime (for example, CUTLASS DSL, einops, and Apache TVM FFI). The curated extra installs these commonly-needed dependencies in one go:

pip install "kernels[curated]"

On XPU (Intel GPU) platforms, use the curated-xpu extra instead, which omits the CUDA-only dependencies:

pip install "kernels[curated-xpu]"

On Windows, we recommend using the Linux version of Torch through WSL 2, since many more kernels support Linux. If you want to use GPU acceleration, check out the CUDA on WSL and PyTorch with DirectML on WSL 2 guides.

We strongly recommend not using a free-threaded Python build yet. These builds are not only experimental, but do not support the stable ABI on Python versions before 3.15. Kernels are compiled with the stable ABI to support a wide range of Python versions.

Xet Storage Details

Size:
2.12 kB
·
Xet hash:
ee6ff0b9b26f1973c0cda92d5c8fca08f070d1629235c404c6b295a62c83e7f0

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.