Skip to main content

Python interface for the kANNolo library

Project description

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 - Maximum performance

If you want to compile the package optimized for your CPU, you need to install the package from the Source Distribution. In order to do that you need to have the Rust toolchain installed. Use the following commands:

Prerequisites

Install Rust (via rustup):

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Installation

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

This will compile the Rust code tailored for your machine, providing maximum performance.

Python - Easy installation

If you are not interested in obtaining the maximum performance, you can install the package from a prebuilt Wheel. If a compatible wheel exists for your platform, pip will download and install it directly, avoiding the compilation phase. If no compatible wheel exists, pip will download the source distribution and attempt to compile it using the Rust compiler (rustc).

pip install kannolo

Prebuilt wheels are available for Linux platforms (x86_64, i686, aarch64) with different Python implementation (CPython, PyPy) for linux distros using glibc 2.17 or later. Wheels are also available x86_64 platforms with linux distros using musl 1.2 or later.

Rust

This command allows you to compile all the Rust binaries contained in src/bin

RUSTFLAGS="-C target-cpu=native" cargo build --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.

Disclaimer: The results in the paper are obtained with a direct-access table shared among threads to keep track of visited nodes. In the current version, this is substituted with a hash set, with the double goal of simplifying the code for users and to make it independent of the size of the dataset, a feature that one would like to enable when dealing with large datasets. This may affect performance.

📚 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"
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kannolo-0.2.2.tar.gz (651.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kannolo-0.2.2-cp312-cp312-manylinux_2_34_x86_64.whl (658.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

File details

Details for the file kannolo-0.2.2.tar.gz.

File metadata

  • Download URL: kannolo-0.2.2.tar.gz
  • Upload date:
  • Size: 651.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.3

File hashes

Hashes for kannolo-0.2.2.tar.gz
Algorithm Hash digest
SHA256 9470322971474910557c0f68dd104da0235273ac4300cf8f2d25080284c8364a
MD5 5dec6ea9caa00fd2f6fc33c5ade6addb
BLAKE2b-256 7b17a725284779ea15f767f3a9669c37b8af567398b29528a817e26534b55058

See more details on using hashes here.

File details

Details for the file kannolo-0.2.2-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kannolo-0.2.2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2c00794c86346d8005f2d411631996d81b4936a047142b0a1c4f055c1b0b1214
MD5 93ec6db05dd0d7005295842c00694d6b
BLAKE2b-256 bfbbc21e428bd2d75c3923b34901fb889bc2a306c76cd3b880c4401c7c685f98

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page