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.2

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.2
File Size Uploaded
kannolo-0.11.2.tar.gz 731.9 kB Details

Built distributions (wheels)

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

Total release size: 16.1 MB

Release files / kannolo-0.11.2.tar.gz

Download URL kannolo-0.11.2.tar.gz
Size 731.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b99f8905609d0c3e703762698199912720045d3e2ae7d84ea2c16c0929434bda
BLAKE2b-256 checksum
How to use checksums
fa19315953e2a98cc214b611d2c3d312da23ff8f34f6c4950d2859cb155afbca
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.2-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL kannolo-0.11.2-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
9db096fdbe7c88c7d69b7c525bb6212d2e9ad19904926ff7cd2bdf071cd85aa2
BLAKE2b-256 checksum
How to use checksums
bb7b2473ba74af3130dc50dffb39222b8129550e10317a0df16cebcadb93eb57
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.2-cp313-cp313-macosx_11_0_arm64.whl

Download URL kannolo-0.11.2-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
07a333e10e5c3c6dcbc58ade4e6263923e9c35336b74e55ec09360374e9e8e7f
BLAKE2b-256 checksum
How to use checksums
dc44cbe9fe3242e1dac58dfd2381bd8e8d9b88c8726df235faa4f6c1be8bd1ed
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.2-cp313-cp313-macosx_10_12_x86_64.whl

Download URL kannolo-0.11.2-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
9162eaf6a79081c25073bd0201bc5098cb5806c52f81d3463a75be20a9772ed9
BLAKE2b-256 checksum
How to use checksums
a657c052efad1e224d5989efd967ed3f0c04b9eb419731c2537a9649ceb8f790
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.2-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL kannolo-0.11.2-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
ebde2f970f12c4514afaea8e0cfc5531e7c8e23969bc793eb754efd842f1c49a
BLAKE2b-256 checksum
How to use checksums
a2ef968d22763246a46e43c1d54e60b57eacf5a2d74f546271131d8a5f7b9ff0
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.2-cp312-cp312-macosx_11_0_arm64.whl

Download URL kannolo-0.11.2-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
310a1437937497e721447af566eaf5753952c1039e7a4291def652e1f66c3b63
BLAKE2b-256 checksum
How to use checksums
dfd3bf1259db18dbfe055c799397b26cef4d8685f1ae7e5e31627e40df998d76
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.2-cp312-cp312-macosx_10_12_x86_64.whl

Download URL kannolo-0.11.2-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
5df9cfb6af51c9c8ab14f5ad4704e86f05dda9a474e45e4e3c69c0748c108ea0
BLAKE2b-256 checksum
How to use checksums
d3b0055bd7912685134378809ec2c4b0adcf530913b730af01e662dd0f5c1d25
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.2-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL kannolo-0.11.2-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
af1b3ef3f74b1c356b24f013e1d39d1937ac074325bc45998fc6ff812b6abb6d
BLAKE2b-256 checksum
How to use checksums
5cf450140a8af1f2879a0ee930ca982180b69ab897aff1352c838616d24a3012
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.2-cp311-cp311-macosx_11_0_arm64.whl

Download URL kannolo-0.11.2-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
a60acc0d43135a42684f0e6dab5b5ce50fd936aeef9047322a08f20d0bc44908
BLAKE2b-256 checksum
How to use checksums
463ae85d54c4f555e554881d0bc65fb40786124f7ac6584ee168071994a8b049
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.2-cp311-cp311-macosx_10_12_x86_64.whl

Download URL kannolo-0.11.2-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
5df15e5756216e7b5a0a9a04607ee90bc4ae22f7eb491600bfed917dd226fa65
BLAKE2b-256 checksum
How to use checksums
b2c31ac68ee8b743cd55aa87d471e2d3d74f2b12580f38f1b4da19b2f93d4662
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.2-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL kannolo-0.11.2-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
3438feb7cd0474a710502af6e42e480e00922274f6aec8b66e3decc579772779
BLAKE2b-256 checksum
How to use checksums
e1ed41e27de85630cff2a968c2c59d4531caf97f9c6d0d53b6288cca2b104bac
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.2-cp310-cp310-macosx_11_0_arm64.whl

Download URL kannolo-0.11.2-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
8a05b7c042021651bbef7e8240b8e81f42ae129435c628be8305aab7ec885825
BLAKE2b-256 checksum
How to use checksums
c68d686bfa931b1c4aa52e107e1da3f3462d4a41a85ed857340b6c33dc27d94b
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.2-cp310-cp310-macosx_10_12_x86_64.whl

Download URL kannolo-0.11.2-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
c3a17ad655d895a6423e0299eb3bff0ac8e26460933a654a68b433ece389f70f
BLAKE2b-256 checksum
How to use checksums
2484d56165a595ce90bddd583a105b1318ac516f94d7c5ccc406c2de7c296415
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.2 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