Kernels documentation
Installation
Getting started
Using kernels
QuickstartUsing LayersLocking Kernel VersionsEnvironment VariablesMigrating from older versionsIntegrating kernels into a projectFAQ
Building kernels
Writing KernelsBuilding kernelsLocal DevelopmentIDE SetupKernel RequirementsSecurityWhy Nix?Metal NotesBuild VariantsBuilding kernels with agents
API Reference
CLI Reference
kernels benchmarkkernels checkkernels versionskernels lockkernels downloadkernel-builder skillsBuilder CLI Reference
Design
You are viewing main version, which requires installation from source. If you'd like
regular pip install, checkout the latest stable version (v0.14.1).
Installation
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"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.
Update on GitHubWe 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.