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_search_dense, 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, hnsw_rerank_search_dense, 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.11.0

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.11.0
File Size Uploaded
kannolo-0.11.0.tar.gz 728.7 kB Details

Built distributions (wheels)

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

Total release size: 16.0 MB

Release files / kannolo-0.11.0.tar.gz

Download URL kannolo-0.11.0.tar.gz
Size 728.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9402d9bdfe0d201277b4233bb8a619bb2bd45992928c567648d9c43143360b6c
BLAKE2b-256 checksum
How to use checksums
dff5fee48063ecb8cede0ca865e427ab7d3fe74662d4cd7c4f2ce6de5ab0cdf5
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.11.0-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL kannolo-0.11.0-cp313-cp313-manylinux_2_34_x86_64.whl
Size 1.4 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
5bd0460c32cf5620778212ee44e83af13863d9765742d29ec8c559981fde5467
BLAKE2b-256 checksum
How to use checksums
4f20fe11b4f584ae28f55d22d2a9d7e4aa4e8b0255870f0b4b9b9485f49e345e
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.11.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL kannolo-0.11.0-cp313-cp313-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
91dfcc4808723e904a85adf24af5b6731984e007bd1afac2decf4949d0c2e1c4
BLAKE2b-256 checksum
How to use checksums
d2ee9dff3210bb7b9a6d49f7c74ff6fc507f8b6aeb3f476665a4503ea7c02df1
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.11.0-cp313-cp313-macosx_10_12_x86_64.whl

Download URL kannolo-0.11.0-cp313-cp313-macosx_10_12_x86_64.whl
Size 1.3 MB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8e3f69a60998d18644b0fd46d9d9dc407ec9a0e89c093dd8321584249ecc96c7
BLAKE2b-256 checksum
How to use checksums
2b516221bf27b96d6ab0c727a601563532899076608ec94a2817ac3693f072b9
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.11.0-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL kannolo-0.11.0-cp312-cp312-manylinux_2_34_x86_64.whl
Size 1.4 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
89aae502021372a2445b9c925bf8401080b7cd394aa5e7520b2677f78815ad03
BLAKE2b-256 checksum
How to use checksums
0c2735afd192dabdf75345d7737fd626dbd6836373676876268ad61bc9233405
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.11.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL kannolo-0.11.0-cp312-cp312-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e81ba1d05092cb22f4c7379f4223826b110ffa1f74f99d9d886ec3debb7c3dde
BLAKE2b-256 checksum
How to use checksums
525323ca2a9bca23b6460ae63aef70bf1c2c93ab60e61da3186ddd5d5e563191
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.11.0-cp312-cp312-macosx_10_12_x86_64.whl

Download URL kannolo-0.11.0-cp312-cp312-macosx_10_12_x86_64.whl
Size 1.3 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0d71558119080dc887c01171666f53c9513a0d8707e59e67454a15b566d82f6f
BLAKE2b-256 checksum
How to use checksums
e314a063c77f0009df1fad5a94cbbbf3c94c1e528b9d38641ab6b52c47beda63
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.11.0-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL kannolo-0.11.0-cp311-cp311-manylinux_2_34_x86_64.whl
Size 1.4 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
929e2fd7c688bf958fdc53de572be6556233cc5f34c13a8f0d4428f93a5e9f9d
BLAKE2b-256 checksum
How to use checksums
49ab1c5deeb78ada883be80f859535e0ff306eb5c849e22a99c1f5dc44a0ada8
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.11.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL kannolo-0.11.0-cp311-cp311-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
670e456b9409be569f9a10c5830ca158c73a86fa57e559f19985b762e0877c83
BLAKE2b-256 checksum
How to use checksums
39ddf466e2c4ab14c4804df26fbc277b0f0fc392cdb08b0969922e467e8c9075
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.11.0-cp311-cp311-macosx_10_12_x86_64.whl

Download URL kannolo-0.11.0-cp311-cp311-macosx_10_12_x86_64.whl
Size 1.3 MB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
7b2951ce35b6ddea39f9b01004de0a40daa918b42bb5c8584a85faa82ee83bf5
BLAKE2b-256 checksum
How to use checksums
134e1b8f7bf1e5fb7c20e65e8edf8676324af08c2df747a93861425c9be96dc0
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.11.0-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL kannolo-0.11.0-cp310-cp310-manylinux_2_34_x86_64.whl
Size 1.4 MB
Tags CPython 3.10 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
f43e61d1fbefb137c3f07f2e28faa1f0330b68bfc98fd6ac2f4ff584f10af9f0
BLAKE2b-256 checksum
How to use checksums
08c4c9b86c7223366e4535801281da16491768d7c62367bf5e384ab07764d936
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.11.0-cp310-cp310-macosx_11_0_arm64.whl

Download URL kannolo-0.11.0-cp310-cp310-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6407437be980abb3c21f8cf060eb5fc32299fd7c0866a41a6ca489f7d4993f15
BLAKE2b-256 checksum
How to use checksums
de7a248d47b9029915485ddcb3fc39dd3047d73305f25f853cc6d59e43827a51
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.11.0-cp310-cp310-macosx_10_12_x86_64.whl

Download URL kannolo-0.11.0-cp310-cp310-macosx_10_12_x86_64.whl
Size 1.3 MB
Tags CPython 3.10 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
72ec2ff70ca908e4db2f60a8870d64eb67471dc16004933d098ea75d7580ec3f
BLAKE2b-256 checksum
How to use checksums
240de24ccfeac23b0198c1aa081322f94b0cda41d9150c281e3802d1f0c0d887
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.11.0 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