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.15.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.15.0
File Size Uploaded Provenance Actions
kannolo-0.15.0.tar.gz 764.4 kB Without provenance Details for kannolo-0.15.0.tar.gz

Built distributions (wheels)

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

Total release size: 18.2 MB

Release files / kannolo-0.15.0.tar.gz

Download URL kannolo-0.15.0.tar.gz
Size 764.4 kB
Tags Source
SHA-256 checksum
How to use checksums
588d07c4369deb10dc1fe5c379db78a269fe9c6a9162e879af7c81a95841ff0e
BLAKE2b-256 checksum
How to use checksums
5b2927ffd98d65f312bc331dc8fbb37730ed701926ac6f31d7d687f25dd658a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL kannolo-0.15.0-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
65bd3aee1863208efeeb9a2994657ddd884328bf8139182e055f9b244ad590a4
BLAKE2b-256 checksum
How to use checksums
86796a299354f1738dbe933fa284c2e21f70469ee29c599961ff45e8cbca4dc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL kannolo-0.15.0-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
bf7503382e57eab82db5a5c58aebb5b10ab3ac5b061b606892030fad29e05a96
BLAKE2b-256 checksum
How to use checksums
7a4122d00c17d4a9e3d750fe51b49b613c5fa1f63fdd66cd18f888beb5c971c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL kannolo-0.15.0-cp313-cp313-macosx_10_12_x86_64.whl
Size 1.5 MB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
177315c518c41d3f48e71f908d949f6f3915e2763532a709d61aefe66e0cea90
BLAKE2b-256 checksum
How to use checksums
0eea8ab0f5f8ba5112540920aa75c879cddfceaf8126a1d2df1fd3c203480ff5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL kannolo-0.15.0-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
fb79314c65057fb1f8fbe8f2cfae1b902ba204272d4b2833ab8f9cd1523f963c
BLAKE2b-256 checksum
How to use checksums
6e55be5a15fdb70ccd91a9e1d1b9f60a7b09f5352e2bcde70c93ae992fe4f913
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL kannolo-0.15.0-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
e76f0080e2918b6313776557d22efac894f6fd829cc66700e0cd68a64ca40444
BLAKE2b-256 checksum
How to use checksums
c4e97709f5d750179a9dbe6b3fdb7aebad20145d634ed67e68a9b695d8995f06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL kannolo-0.15.0-cp312-cp312-macosx_10_12_x86_64.whl
Size 1.5 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9249ee9023026c0477dbcd04c8ad3d40a499714e7668d098fed92386d3cf328d
BLAKE2b-256 checksum
How to use checksums
d1404fe47f834b61b8a0c8d9ee473b1b00899eb74937302be234b34636c2f412
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL kannolo-0.15.0-cp311-cp311-manylinux_2_34_x86_64.whl
Size 1.6 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
a0df2e3c8bf1583052563eb92cbf6e2cf78117c6df395347e0232c36cbde7ae0
BLAKE2b-256 checksum
How to use checksums
7b70ed5050b9ac550b620f981dd91da93a19fb1b573bb205bfb5da0d58349a2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL kannolo-0.15.0-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
92dbc90fafc126cb58f4c02f453e1eaa220523bc50a7c850f375157f2e647bad
BLAKE2b-256 checksum
How to use checksums
a189f4f5e94fc90d0adbd61bf214137bdea94c4efc4d885e6cf9be36d92b2942
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL kannolo-0.15.0-cp311-cp311-macosx_10_12_x86_64.whl
Size 1.5 MB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
70b71213d80341f62aa7a02dceec46f7a2c2072d209575a72bf875125b35cf56
BLAKE2b-256 checksum
How to use checksums
69b4cfd292f36872c8bf34829bad6a1b03080ba2082d967adc47457059a3753c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL kannolo-0.15.0-cp310-cp310-manylinux_2_34_x86_64.whl
Size 1.6 MB
Tags CPython 3.10 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
2d3d2c326229c9522222ec826bc169ed9dbbeca91f321f5a4cd53aab262ad2fb
BLAKE2b-256 checksum
How to use checksums
8c31d83ad37a7e2d2bd631df625325ee41eddedcf80ce16006c4daaf5025ed12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL kannolo-0.15.0-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
241fc5a45270d1711eeb7f8fe31cb1d64de7f1aea791d7c9ef325235c4a5d6fd
BLAKE2b-256 checksum
How to use checksums
2a7bb7dc53bb66bc3e8dbe6e4575cbc423492fb3b3c8d95e8c7b8807d4f90297
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

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

Download URL kannolo-0.15.0-cp310-cp310-macosx_10_12_x86_64.whl
Size 1.5 MB
Tags CPython 3.10 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
25928a070babe0815e54981b4654b08ada7f4918a7bf73e3805de8a048cb93dc
BLAKE2b-256 checksum
How to use checksums
b40bac253b0c5a8d7e8540d4b58293fbca5d72a1bf0da2bd2f18cced02e1191d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for kannolo 0.15.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.15.0 This release

13 release files No provenance

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