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.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.11.1
File Size Uploaded
kannolo-0.11.1.tar.gz 730.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for kannolo 0.11.1
File
kannolo-0.11.1-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details
kannolo-0.11.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
kannolo-0.11.1-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details
kannolo-0.11.1-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details
kannolo-0.11.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
kannolo-0.11.1-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
kannolo-0.11.1-cp311-cp311-manylinux_2_34_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.34+ x86-64 Details
kannolo-0.11.1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
kannolo-0.11.1-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details
kannolo-0.11.1-cp310-cp310-manylinux_2_34_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.34+ x86-64 Details
kannolo-0.11.1-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
kannolo-0.11.1-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.1.tar.gz

Download URL kannolo-0.11.1.tar.gz
Size 730.1 kB
Tags Source
SHA-256 checksum
How to use checksums
38e2caad32f384ca2b0e472d0c7a0608598bfb1ca56164f4cb4fd1cf88b128d1
BLAKE2b-256 checksum
How to use checksums
6151768e30a7e41f43bb203e8f01737514a49d8624fb25977c4361b46c6a9b2e
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.1-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL kannolo-0.11.1-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
2c9f3baaaa63cbbe250dc5e126d55f3607c6431f8608833511db33b7f13ac895
BLAKE2b-256 checksum
How to use checksums
b4bf6f4a15756c314ad29109b5b8c2ea930ec084f23b3f291315048c6cbc641b
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.1-cp313-cp313-macosx_11_0_arm64.whl

Download URL kannolo-0.11.1-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
884e49cc26b49390231efba089a2b17cab00a79b5614cbff43f367c4a1e6faad
BLAKE2b-256 checksum
How to use checksums
8dec8dd21551e1b82c60f25d7d3bf39602d47d7cf886b5804bc1b9225cdd756b
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.1-cp313-cp313-macosx_10_12_x86_64.whl

Download URL kannolo-0.11.1-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
ce848735fb0cc8dd8e5dc328e2e5eff358e229d8e47ed0367514795ff679865b
BLAKE2b-256 checksum
How to use checksums
2e61b8e6a82037c535dd1ac848567cdf6faa4b7451432ed00d5862691c197f28
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.1-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL kannolo-0.11.1-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
d5f314d0e4b965ae6cff3d7b0f2ed7fcdb35c1479e44ed19dd2eae495a2555b8
BLAKE2b-256 checksum
How to use checksums
81ed5670417e6dacb82cb5e7501850e18612dcafe160b67de843b0e3b1f812f7
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.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL kannolo-0.11.1-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
141c41a71176dc59d24e7e6988c16ade55a7dd18e8ce97fca07e1d24e099b56e
BLAKE2b-256 checksum
How to use checksums
eca08d46f07f9aaf3dfb8ebb5fd17f43072e5b88a3140eeb71cd0d79dd771cd8
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.1-cp312-cp312-macosx_10_12_x86_64.whl

Download URL kannolo-0.11.1-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
87a02853cd6611b9e6f2cc52b1ada16ef90ba4f49af74f4c439bee25c0dd967c
BLAKE2b-256 checksum
How to use checksums
09b3bc0ae7a203f585c11d549cf25e66b08f6db12948e2233b468bad86b5ea65
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.1-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL kannolo-0.11.1-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
bf5f9dfbd5c28e04b48fbbc4690c79212d48b1115989051bcb623cc593756149
BLAKE2b-256 checksum
How to use checksums
a304d8b415e2c9ff6b4ba32c869dbbbd2ec36ea6fbfe4f3656926d471ab633d9
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.1-cp311-cp311-macosx_11_0_arm64.whl

Download URL kannolo-0.11.1-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
c4188835e95c3a75fde7129565ae8cd7c03305cc78667e29b6ba40cdc15529ec
BLAKE2b-256 checksum
How to use checksums
bec2f9fa3e6b72e6f31173ca2a26c2394c94104b00fe786ec694e39f4b6e9b82
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.1-cp311-cp311-macosx_10_12_x86_64.whl

Download URL kannolo-0.11.1-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
b8ba0b3793ddc2b3c9ae139967ca8bce52a8b42c6fc406567a1824463dc4979d
BLAKE2b-256 checksum
How to use checksums
75983074164299aef26879c057bca3edfe863473f8b3dc5f32a5b33cf69473b8
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.1-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL kannolo-0.11.1-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
6006d779d8c988045f4e4a213734b5c1166bd6510fa9f538ac0b8ad105867dc1
BLAKE2b-256 checksum
How to use checksums
2788327f3c6d58b88abc695f556f6a50aa85524baec4472cde9bf4143a0dffb3
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.1-cp310-cp310-macosx_11_0_arm64.whl

Download URL kannolo-0.11.1-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
bd7008b3591d57900e7ac083049221768deeb25842c59b44e181e7427e519372
BLAKE2b-256 checksum
How to use checksums
8175191d1bf184f9c865bb3655e091699888a93fbc1df053e2a274c73e636b5b
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.1-cp310-cp310-macosx_10_12_x86_64.whl

Download URL kannolo-0.11.1-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
ea616d820ff23d26951aaf6ea604504f68511b2e2ca39a563ec2e18b2df07c48
BLAKE2b-256 checksum
How to use checksums
29a12002aef6cda598e5e9327d7456e299437ab74e2e182d2334d52a5628b8cd
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.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