Skip to main content

kANNolo

kANNolo is a research-oriented library for Approximate Nearest Neighbors (ANN) search written in Rust 🦀. It is explicitly designed to combine usability with performance effectively. Designed with modularity and researchers in mind, kANNolo makes prototyping new ANN search algorithms and data structures easy. kANNolo supports both dense and sparse embeddings seamlessly. It implements the HNSW graph index and Product Quantization.

Python Installation

Quick start (prebuilt wheels)

For most users, this is the easiest option:

pip install kannolo

The prebuilt wheel includes dense and sparse HNSW indexes. If a compatible wheel exists for your platform, pip downloads and installs it directly. If not, pip compiles from source.

To use multivector reranking (SparseMultivecRerankIndex, SparseMultivecTwoLevelsPQRerankIndex), build from source with the multivec feature enabled (see Building from source below).

Building from source (maximum performance)

For maximum performance optimized to your CPU, build from source. Choose one of the two approaches below:

Shared Prerequisites

Both building approaches require Rust and nightly:

  1. Install Rust (via rustup):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  1. Activate nightly:
rustup install nightly
rustup default nightly

Approach 1: Build from PyPI source

Compile and install directly from PyPI with CPU optimization (dense and sparse indexes only):

RUSTFLAGS="-C target-cpu=native" pip install --no-binary :all: kannolo

This installs the package in your system/virtual environment site-packages. For multivector reranking support, use Approach 2 instead.

Approach 2: Build from GitHub (development mode)

Clone the repository and build for development/modification:

  1. Clone and prepare:
git clone https://github.com/TusKANNy/kannolo.git
cd kannolo
  1. Create a virtual environment (recommended):
python3 -m venv ./venv
source ./venv/bin/activate  # On Windows: venv\Scripts\activate

Alternatively, use conda:

conda create -n kannolo python=3.11
conda activate kannolo
  1. Install maturin:
pip install maturin
  1. Build and install in editable mode:

    Dense and sparse indexes only (default, lighter build):

    RUSTFLAGS="-C target-cpu=native" maturin develop --release
    

    With multivector reranking support (SparseMultivecRerankIndex, SparseMultivecTwoLevelsPQRerankIndex):

    RUSTFLAGS="-C target-cpu=native" maturin develop --release --features multivec
    

Why use editable mode? Changes to Python code take effect immediately without reinstalling. Perfect for development and prototyping.

  1. Verify installation:
python -c "import kannolo; print('Successfully installed kannolo!')"

Rust

The crate exposes three feature flags:

Feature What it enables Default
multivec Multivector reranking indexes (SparseMultivecRerankIndex, SparseMultivecTwoLevelsPQRerankIndex) and the hnsw_rerank_search CLI binary No
python PyO3 bindings — activated automatically by maturin when building the Python wheel No
cli CLI binaries: hnsw_build, hnsw_search, hnsw_rerank_{build,search}_{dense,sparse}, ivf_build, ivf_search (combine with multivec to also get hnsw_rerank_search) No

If you want to compile the library only (dense and sparse indexes, no multivec, no binaries):

RUSTFLAGS="-C target-cpu=native" cargo build --release

If you want the CLI binaries hnsw_build, hnsw_search, the two-stage hnsw_rerank_{build,search}_{dense,sparse}, ivf_build and ivf_search (dense and sparse):

RUSTFLAGS="-C target-cpu=native" cargo build --release --features cli

If you want multivector reranking in the library (adds SparseMultivecRerankIndex and SparseMultivecTwoLevelsPQRerankIndex):

RUSTFLAGS="-C target-cpu=native" cargo build --release --features multivec

If you want all CLI binaries including hnsw_rerank_search:

RUSTFLAGS="-C target-cpu=native" cargo build --release --features "cli,multivec"

The resulting binaries are placed in target/release/.

Details on how to use kANNolo's core engine in Rust 🦀 can be found in docs/RustUsage.md.

Details on how to use kANNolo's Python interface can be found in docs/PythonUsage.md.

Resources

Check out our docs folder for a more detailed guide on how to use kANNolo directly in Rust, replicate the results of our paper, or use kANNolo with your custom collection.

📚 Bibliography

Leonardo Delfino, Domenico Erriquez, Silvio Martinico, Franco Maria Nardini, Cosimo Rulli and Rossano Venturini. "kANNolo: Sweet and Smooth Approximate k-Nearest Neighbors Search." Proc. ECIR. 2025.

Citation License

The source code in this repository is subject to the following citation license:

By downloading and using this software, you agree to cite the under-noted paper in any kind of material you produce where it was used to conduct a search or experimentation, whether be it a research paper, dissertation, article, poster, presentation, or documentation. By using this software, you have agreed to the citation license.

ECIR 2025

@InProceedings{10.1007/978-3-031-88717-8_29,
author =    "Leonardo Delfino and
             Domenico Erriquez and
             Silvio Martinico and
             Franco Maria Nardini and
             Cosimo Rulli and
             Rossano Venturini",
title =     "kANNolo: Sweet and Smooth Approximate k-Nearest Neighbors Search",
booktitle = "Advances in Information Retrieval",
year =      "2025",
publisher = "Springer Nature Switzerland",
pages =     "400--406",
isbn =      "978-3-031-88717-8"
}

Metadata

Release files for kannolo 0.12.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kannolo 0.12.1
File Size Uploaded
kannolo-0.12.1.tar.gz 747.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for kannolo 0.12.1
File
kannolo-0.12.1-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details
kannolo-0.12.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
kannolo-0.12.1-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details
kannolo-0.12.1-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details
kannolo-0.12.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
kannolo-0.12.1-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
kannolo-0.12.1-cp311-cp311-manylinux_2_34_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.34+ x86-64 Details
kannolo-0.12.1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
kannolo-0.12.1-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details
kannolo-0.12.1-cp310-cp310-manylinux_2_34_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.34+ x86-64 Details
kannolo-0.12.1-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
kannolo-0.12.1-cp310-cp310-macosx_10_12_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.12+ x86-64 Details

Total release size: 17.6 MB

Release files / kannolo-0.12.1.tar.gz

Download URL kannolo-0.12.1.tar.gz
Size 747.4 kB
Tags Source
SHA-256 checksum
How to use checksums
125aa8ed625df716b43432b6e1adcbf6aca95cda5573944e2749638c9b28a2a4
BLAKE2b-256 checksum
How to use checksums
bae869cb7fd8998ea8355ecf6e61a17faef0796d400d02e13f144c329b860e89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kannolo-0.12.1-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL kannolo-0.12.1-cp313-cp313-manylinux_2_34_x86_64.whl
Size 1.6 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
0d84b82e8e30c8db4ca5a5c111858e7dbc178ae8aaf311b3f5910b1a67adf43b
BLAKE2b-256 checksum
How to use checksums
32c26dd641b0c593a6dd15326f6363cf1b3a28d523d4811041c15be362a2a169
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kannolo-0.12.1-cp313-cp313-macosx_11_0_arm64.whl

Download URL kannolo-0.12.1-cp313-cp313-macosx_11_0_arm64.whl
Size 1.2 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
972dbf3bbce99724a7f418470077a6728b7a0684ff35751356ed5ccdc45c9fe6
BLAKE2b-256 checksum
How to use checksums
11cc02ab0720007f933c6adb7b64db8b6ec9ed1371569f3b4e9b1c7dbbb0a56a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kannolo-0.12.1-cp313-cp313-macosx_10_12_x86_64.whl

Download URL kannolo-0.12.1-cp313-cp313-macosx_10_12_x86_64.whl
Size 1.4 MB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
14852f2393dbab9a177c8a97b02be78fb36d0f6ce21b682410516b16ab5dbb30
BLAKE2b-256 checksum
How to use checksums
7c766ab3205c71f21bbdbc703be6ecdd22ab7c48128e94b00fa959611b1974f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kannolo-0.12.1-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL kannolo-0.12.1-cp312-cp312-manylinux_2_34_x86_64.whl
Size 1.6 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
ac7a3228a41cbd87ed3804b5130708a0fe52e86dbd6a7c05c8e73558f882ca6e
BLAKE2b-256 checksum
How to use checksums
6cd651f8cd6d3fd5895b9b614c581d7ab2f0659cdeac25ebc88697e2931aa943
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kannolo-0.12.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL kannolo-0.12.1-cp312-cp312-macosx_11_0_arm64.whl
Size 1.2 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
64a2afaa204d5895cd015940d6c816ecb6257f272e19a650c958cf0787992cd3
BLAKE2b-256 checksum
How to use checksums
ccf9192f02a6a97bd5504d4576059e9f2515294c01fb4d9b161272b9d430e19c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kannolo-0.12.1-cp312-cp312-macosx_10_12_x86_64.whl

Download URL kannolo-0.12.1-cp312-cp312-macosx_10_12_x86_64.whl
Size 1.4 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
fcdf68abbaa84e1eda69cd91ce0741784eb3e40dcd502b83f862aba38e250ea0
BLAKE2b-256 checksum
How to use checksums
32108fd2d1015cd6145f7f705a72d4ca904d881fca712effe6d8f378d708def7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kannolo-0.12.1-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL kannolo-0.12.1-cp311-cp311-manylinux_2_34_x86_64.whl
Size 1.5 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
3753c0c2b71c4e3d9f11df4008d53fd52a4afccf44a3d2d7f0b7b4ee760bbe4b
BLAKE2b-256 checksum
How to use checksums
ecad57ec031751790c6df2bf4d389f4e2e2177bd538ccdfa656419f3a398d020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kannolo-0.12.1-cp311-cp311-macosx_11_0_arm64.whl

Download URL kannolo-0.12.1-cp311-cp311-macosx_11_0_arm64.whl
Size 1.2 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
469240e6fbe226dd9963b90c697fd798199bafb3cbb040055870e45de01f852b
BLAKE2b-256 checksum
How to use checksums
e6b0e1cd34a692731e863e2f6eeda446f0628536360ede3d76e5b7eb0e342690
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kannolo-0.12.1-cp311-cp311-macosx_10_12_x86_64.whl

Download URL kannolo-0.12.1-cp311-cp311-macosx_10_12_x86_64.whl
Size 1.4 MB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8c0923b0099b194085192ad5ee8ae90c0cbaee70ab696768e1756ba9a5312378
BLAKE2b-256 checksum
How to use checksums
0d95015272eaa4fb5f509a1ca8998012bcea727417ab052892a8403e31f07671
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kannolo-0.12.1-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL kannolo-0.12.1-cp310-cp310-manylinux_2_34_x86_64.whl
Size 1.5 MB
Tags CPython 3.10 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
e2064ab6784c6188837807610a9191460ece34fdca04dad34735283db9612321
BLAKE2b-256 checksum
How to use checksums
79330f7b991e70d288f5df8b217c555f547687c1b44d8e2415ab4e84165b6f99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kannolo-0.12.1-cp310-cp310-macosx_11_0_arm64.whl

Download URL kannolo-0.12.1-cp310-cp310-macosx_11_0_arm64.whl
Size 1.2 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d3dcfafe29b5de40492f6789a09e3755fe5f10f172edb65d20d865e0b52fe774
BLAKE2b-256 checksum
How to use checksums
3a4dc824d8e635d935911f03c571cfd0d0455681c4cda4538dbc3c20e6bf9159
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / kannolo-0.12.1-cp310-cp310-macosx_10_12_x86_64.whl

Download URL kannolo-0.12.1-cp310-cp310-macosx_10_12_x86_64.whl
Size 1.4 MB
Tags CPython 3.10 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
edc90db65addadb5916e3b9e6958008139a004e5d648bfdac1054e74c0ac2dfb
BLAKE2b-256 checksum
How to use checksums
1f85c6ede9a0f141697182be6e4e5335c377c32876f23db0ca24ef2e26c06bcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.12.1 This release

13 release files

0.9.2

13 release files

0.9.1

13 release files

0.9.0

13 release files

0.6.1

13 release files

0.6.0

13 release files

0.5.5

13 release files

0.5.4

13 release files

0.5.3

13 release files

0.5.2

13 release files

0.5.1

13 release files

0.4.9

13 release files

0.4.8

13 release files

0.4.6

21 release files

0.4.5

21 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page