Installation#
Kornia is distributed as pure-Python wheels on PyPI and on
conda-forge. It requires
PyTorch 2.5.1 or newer; the only other dependencies are
numpy and kornia-rs (the Rust image I/O
backend used by kornia.io). Install PyTorch first if you need a specific CUDA build.
pip install kornia
conda install -c conda-forge kornia
pip install git+https://github.com/kornia/kornia
or, from a local clone, an editable install for development:
git clone https://github.com/kornia/kornia.git
cd kornia
pip install -e .
Once the installation has finished, check that you can import the package:
python -c "import kornia; print(kornia.__version__)"
Pretrained models (RT-DETR, LoFTR, DISK, SAM, …) download their checkpoints on first use, so no extra installation step is needed for them.
Optional extras#
A few Kornia features wrap third-party packages that are not installed with the base wheel. They are
declared as extras,
so you only pay for the ones you use. If one of the extras below is missing, the corresponding Kornia
object raises an ImportError naming the extra to install. The installation mode changes this: set
kornia.config.kornia_config.lazyloader.installation_mode, or the KORNIA_INSTALLATION_MODE
environment variable before Kornia is imported, to "ask" to be asked on an interactive terminal
whether to install the extra, or to "auto" to install the declared extra with
pip install "kornia[<extra>]" without asking. Without an interactive terminal, "ask" raises the
same ImportError: for example in a CI job, when output is redirected to a file, or in a Jupyter
notebook, whose kernel’s stdin is not a terminal (use "auto" there). The default is "raise".
Extra |
What it enables |
Install command |
|---|---|---|
|
Pillow-backed PIL input/output and display helpers, plus remote image decoding in |
|
|
kornia.onnx, ONNX export of Kornia modules, and |
|
|
|
|
|
Contributor environment: the test and lint toolchain (includes |
|
|
Documentation toolchain, on top of |
|
Next steps#
What is Kornia? – what Kornia is and what each module contains.
Conventions & Pitfalls – the tensor layout, coordinate and angle conventions to know before writing code.
Applications – end-to-end guides, or the API reference.