$npx skillfedfor your agent

hnswlib

hnswlib

With conditionsPyPI Scientific/EngineeringReleased Dec 2023571.8K downloads / moSource build

Decision gist · record as of 2026-08-14

sdist only — hnswlib-0.8.0.tar.gz · builds from source
v0.8.0 · released 2023-12-03 · 1 runtime deps: numpy

Yes, with conditions. Hnswlib is actively maintained, has no known vulnerabilities, and is popular (571766 monthly downloads). Install it if you need fast approximate nearest neighbor search and can handle the C++ compilation requirement. However, verify the license before use in proprietary contexts, and be aware that the last release was 985 days ago—check whether the current version meets your needs or if you need to build from the active repository.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires a C++ compiler and build tools to compile the C++ extension during installation.
  • High install friction due to C++ compilation requirement (header-only HNSW implementation).
  • Package is actively maintained with recent commits and a large repository (5309 stars), but the last release was 985 days ago despite ongoing development activity.

License · maintenance · safety

(unclear) — License treatment is unclear—no SPDX identifier or raw license text is available in the metadata. Verify the actual license before use in proprietary or restricted contexts.

last release 2023-12-03 (985 days) · last repo commit 2026-03-28 · 5,309 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 571,766 downloads/mo, #5,948 on PyPI

Verify before relying

pip install hnswlib
import hnswlib
import numpy as np

index = hnswlib.Index(space='l2', dim=16)
index.init_index(max_elements=100, M=16, ef_construction=200)
data = np.random.random((100, 16))
index.add_items(data, np.arange(100))
labels, distances = index.knn_query(data[:5], k=5)
  • Whether Python version support is truly unspecified or if there are undocumented minimum/maximum version constraints.
  • Current maintenance status and release cadence given the 985-day gap between latest release and active repository commits.
  • Whether the package is suitable for production use given the release timing relative to active development.
Same gist for agents: .md · .json

What it is and what it does

Hnswlib is a Python binding to a header-only C++ implementation of the Hierarchical Navigable Small World (HNSW) algorithm for fast approximate nearest neighbor search. It lets you build an index of high-dimensional vectors and query them efficiently to find the k nearest neighbors, with support for three distance metrics: squared L2, inner product, and cosine distance. The library is designed for incremental workflows—you can add, update, and delete vectors after index creation, mark elements as deleted without rebuilding, and save/load indexes to disk.

The main dependency is numpy for array handling. Installation requires a C++ compiler because the package compiles a native extension at install time. Once built, it offers thread-safe batch operations for both insertion and querying, with tunable parameters (M and ef_construction) to trade off memory footprint and construction speed against query accuracy. It is commonly used in machine learning and information retrieval pipelines where you need to find similar embeddings or vectors quickly without exhaustive search.

Use it for

  • Build a semantic search engine over document embeddings to find similar texts or documents by vector similarity.
  • Implement real-time product recommendation by indexing product embeddings and querying for nearest neighbors to a user's preference vector.
  • Create a reverse image search system by indexing image feature vectors and finding visually similar images.
  • Deduplicate large datasets by indexing all embeddings and finding near-duplicate vectors within a distance threshold.
  • Support incremental machine learning pipelines where new training examples are continuously added to an index for online similarity lookup.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, with conditions.

Hnswlib is actively maintained, has no known vulnerabilities, and is popular (571766 monthly downloads). Install it if you need fast approximate nearest neighbor search and can handle the C++ compilation requirement. However, verify the license before use in proprietary contexts, and be aware that the last release was 985 days ago—check whether the current version meets your needs or if you need to build from the active repository.

Install

hnswlib on PyPI

Before you install

High install friction due to C++ compilation requirement (header-only HNSW implementation). Package is actively maintained with recent commits and a large repository (5309 stars), but the last release was 985 days ago despite ongoing development activity.

Requires a C++ compiler and build tools to compile the C++ extension during installation.

License in practice

License treatment is unclear—no SPDX identifier or raw license text is available in the metadata. Verify the actual license before use in proprietary or restricted contexts.

Quickstart

pip install hnswlib
import hnswlib
import numpy as np

index = hnswlib.Index(space='l2', dim=16)
index.init_index(max_elements=100, M=16, ef_construction=200)
data = np.random.random((100, 16))
index.add_items(data, np.arange(100))
labels, distances = index.knn_query(data[:5], k=5)

Verify before relying

  • Whether Python version support is truly unspecified or if there are undocumented minimum/maximum version constraints.
  • Current maintenance status and release cadence given the 985-day gap between latest release and active repository commits.
  • Whether the package is suitable for production use given the release timing relative to active development.

Package facts

LicenseNot declared unclear
Python supportNot specified
Install frictionHigh. Source build required
Runtime dependencies
1 package
numpy
MaintenanceActively maintained 985 days since the last release
Last repo commit
First released
Downloads571,766 / month, #5,948 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14

Evidence: hnswlib-0.8.0.tar.gz

Tags

Capabilities
approximate nearest neighbor searchvector similarity searchHNSW index pythonfast knn lookupincremental vector indexingembedding search librarysimilarity index construction
Topics
vector-searchapproximate-nearest-neighborhnsw-algorithm

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “HNSW index python”

  • hnswlibFast approximate nearest neighbor search using the HNSW algorithm…
  • usearchUSearch provides approximate nearest-neighbor vector search using…
  • voyagerVoyager performs fast approximate nearest-neighbor searches on…

Give your agent the search over MCP, or paste the wish link into any chat.

More Scientific/Engineering packages

numpy Worth it
PyPI · Software Development · released Aug 2026

NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.

BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0compiled wheel · 3.12+
1.1Bdownloads / mo
pandas Worth it
PyPI · Scientific/Engineering · released Jul 2026

pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.

BSD-3-Clausecompiled wheel · 3.11+
769.1Mdownloads / mo
scipy Worth it
PyPI · Libraries · released Jun 2026

scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.

BSD-3-Clausecompiled wheel · 3.12+
449.0Mdownloads / mo
scikit-learn Worth it
PyPI · Software Development · released Jun 2026

scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.

Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.

BSD-3-Clausecompiled wheel · 3.11+
235.5Mdownloads / mo
dill Worth it
PyPI · Software Development · released Jan 2026

dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.

BSD-3-Clausepure Python · 3.9+
208.1Mdownloads / mo
multiprocess Worth it
PyPI · Software Development · released Jan 2026

Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.

Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.

BSD-3-Clausepure Python · 3.9+
202.7Mdownloads / mo

See also pyspark-hnsw · voyager · usearch · nmslib · cuvs-cu12 · libcuvs-cu12 · pynndescent · annoy · strsimpy