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 Installation

Quick start (prebuilt wheels)

For most users, this is the easiest option:

pip install kannolo

If a compatible wheel exists for your platform, pip will download and install it directly without compilation. If no compatible wheel exists, pip will automatically compile from source.

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:

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

This installs the package in your system/virtual environment site-packages.

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:
RUSTFLAGS="-C target-cpu=native" maturin develop --release

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

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.

📚 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.4.7.tar.gz (652.2 kB view details)

Uploaded Source

Built Distributions

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

kannolo-0.4.7-cp313-cp313-manylinux_2_34_x86_64.whl (951.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

kannolo-0.4.7-cp313-cp313-macosx_11_0_arm64.whl (787.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

kannolo-0.4.7-cp313-cp313-macosx_10_12_x86_64.whl (881.1 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

kannolo-0.4.7-cp312-cp312-manylinux_2_34_x86_64.whl (951.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

kannolo-0.4.7-cp312-cp312-macosx_11_0_arm64.whl (787.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

kannolo-0.4.7-cp312-cp312-macosx_10_12_x86_64.whl (881.4 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

kannolo-0.4.7-cp311-cp311-manylinux_2_34_x86_64.whl (954.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

kannolo-0.4.7-cp311-cp311-macosx_11_0_arm64.whl (789.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

kannolo-0.4.7-cp311-cp311-macosx_10_12_x86_64.whl (888.2 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

kannolo-0.4.7-cp310-cp310-manylinux_2_34_x86_64.whl (954.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

kannolo-0.4.7-cp310-cp310-macosx_11_0_arm64.whl (789.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

kannolo-0.4.7-cp310-cp310-macosx_10_12_x86_64.whl (888.2 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: kannolo-0.4.7.tar.gz
  • Upload date:
  • Size: 652.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kannolo-0.4.7.tar.gz
Algorithm Hash digest
SHA256 17a633c6345483686d8b6c49ed9a9b3341fdc6696e042b6b2b7f94421ff05657
MD5 adea43b1e7ed2d0c9c4b0561e0f54ac9
BLAKE2b-256 f4d2e2795d0c27d8ab0cf88bb5d99933ac194fe50d34b293048dfdbf82ab12c9

See more details on using hashes here.

File details

Details for the file kannolo-0.4.7-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kannolo-0.4.7-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 aaa3e3b416c8cd5aaca44278a61e51140717c73a57beb8045b832b91fc18cfcf
MD5 345cd545c9eddecbe9f9092de994db87
BLAKE2b-256 6b3d0ca9dd1a46de14136020a95e45e30ee2e36b38a8eb96005ac95ec5eb468c

See more details on using hashes here.

File details

Details for the file kannolo-0.4.7-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kannolo-0.4.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6a7e58f95193c08efbb7c106496e3a227c740898b8f7dac1e8b53587c0243d36
MD5 243ea67ab3c4fef5dfa7f74c5192f092
BLAKE2b-256 a8fcb3d19c403b45f9db22d6bca9fe9714355eb3e76210af045a38b3cd5fcd85

See more details on using hashes here.

File details

Details for the file kannolo-0.4.7-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kannolo-0.4.7-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6f9728e729185eeb5a3a0ac670a2b18475b9d32c367573393f3ca1703ce8bd3a
MD5 cd9f4fe1df07d00b3af55bd07e151097
BLAKE2b-256 726c15acb64ffc1010dfd0ba14743f0479b7e38b17dd8a1b8d86beeeb6a4c730

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kannolo-0.4.7-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 eabcda15050a05c7a015d1a8e3cf7594d0676f89b8b69a72936798d0507e84ca
MD5 68293f2be099a0770744562778b97641
BLAKE2b-256 40bc9455b763436dd5e10b70ee982225a7bea15e3ea81f4dc052b88324eb766b

See more details on using hashes here.

File details

Details for the file kannolo-0.4.7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kannolo-0.4.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 77179e90749df9956c3e9437cfa35490bad0a9c90797f152bbf9392b4f1983c1
MD5 8b1100ccb82e5d54ff2b94f791301b7d
BLAKE2b-256 b84af9a57de94d0e21de025bce7da05370ccbfbaade94daaeae60935a3a31ebc

See more details on using hashes here.

File details

Details for the file kannolo-0.4.7-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kannolo-0.4.7-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 130c5e59ca93c700338ffaef815904a000fc1ecbb7122a4bb0879d9afa93801a
MD5 e377cba1619e0089d9f0fd81532da43f
BLAKE2b-256 9e22a130b7aee14019f1330a988731ba6d1f9d69831d8b7ccb1dccf8746be13a

See more details on using hashes here.

File details

Details for the file kannolo-0.4.7-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kannolo-0.4.7-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8c28685bee7699457d43ea8090e6c1566ffaa6e6dddefab78f448c8ea00b11dd
MD5 5b5d53692be7229448507dfc296773a0
BLAKE2b-256 09b3acd53ff81db313406c689a9b263323fd6be4f186a3a2ec8d4c0a9b7f2f1b

See more details on using hashes here.

File details

Details for the file kannolo-0.4.7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kannolo-0.4.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 032b5f3bb773d4046125807e44246f6216cc9e858b9579648415b4ec66ad1034
MD5 9bd91d74f30a2ec35a11ba2556dcefc7
BLAKE2b-256 f1b6d82d7e25aec533d7fa378e7a3d9b35f3e3fb6da1e4af40b32bcfeb11cb45

See more details on using hashes here.

File details

Details for the file kannolo-0.4.7-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kannolo-0.4.7-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 902601e05d225109d498c57936caf302e45a5d5969c8ae0bfa54f32f6fcf35db
MD5 263c429c831c4d91b7e99c34758e80f5
BLAKE2b-256 bfdb96a1f798702e47d43bb687ae7ce2da6cd3556c1e1c8649a6efb850010d09

See more details on using hashes here.

File details

Details for the file kannolo-0.4.7-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for kannolo-0.4.7-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 54f77d9cc7b2afbd310070f061ac276912d8680fd60843e9a144dd74b4ef6da0
MD5 c4adf76f5eb81a8aaecee090c96b7072
BLAKE2b-256 80c8128cfa41df90cb3744be605750f484c32e430ff7f99436066aa9746095e0

See more details on using hashes here.

File details

Details for the file kannolo-0.4.7-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kannolo-0.4.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 59dac1b0e6e3ada8050b36b3274a606116dd81a5291538574c70b188934a8b0d
MD5 6e6b912241907e7629253f6ac6cefe83
BLAKE2b-256 25d5bcfc3a57fd6340ccf28146335e85a86c629232f5636a0552ece191774d39

See more details on using hashes here.

File details

Details for the file kannolo-0.4.7-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kannolo-0.4.7-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 173a4f0a61329390a8152455cc4fbc79abd0cbd9967aadf96872561d09a16e21
MD5 c6dd3d3a753ac7c9a661e44cbf218846
BLAKE2b-256 9ac964982d21f9f41d2472624da814cff8b3d2832f705ec8ecf5416646d2ae3e

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