--- id: nmslib version: "2.1.2" license: unclear license_treatment: unclear maintenance: active --- # nmslib — Non-Metric Space Library (NMSLIB) License: unclear · Maintenance: active · Downloads: 154.3K/mo ## What it is and what it does nmslib is a cross-platform C++ library with Python bindings for searching in metric and non-metric spaces. It specializes in approximate nearest-neighbor methods and provides tools to evaluate similarity search algorithms. The library is built on pybind11 and depends on scipy and numpy, making it suitable for scientific and machine-learning workflows where fast approximate similarity matching is needed. Unlike metric-space libraries that assume triangle inequality, nmslib handles generic and non-metric spaces, which is useful for custom distance functions or domain-specific similarity measures. It offers multiple indexing methods and is actively maintained with wheels for modern Python versions and common platforms. Use it for: - Build a fast approximate nearest-neighbor index for large-scale vector search in recommendation systems or semantic search applications. - Evaluate and benchmark different similarity search algorithms on custom datasets or non-metric distance functions. - Implement similarity matching for embeddings in NLP or computer vision pipelines where exact nearest-neighbor search is too slow. - Search in non-Euclidean or custom metric spaces where standard libraries assume L2 or cosine distance. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. nmslib provides efficient similarity search in metric and non-metric spaces, with support for approximate nearest-neighbor methods and evaluation tools for search algorithms. Yes, if you need efficient approximate similarity search and can tolerate medium install friction from compiled bindings. The library is actively maintained with no known vulnerabilities and offers broad platform support. Verify the license terms and Python version compatibility in the repository before adopting in production. ## Install pip install nmslib uv add nmslib poetry add nmslib ## Installing nmslib Before you install: Medium install friction due to compiled C++ bindings via pybind11. Wheels are available for Python 3.10–3.13 across macOS (Intel and ARM), Linux (x86_64 and aarch64), and Windows. Active maintenance with recent commits suggest reliable upkeep. License in practice: License treatment is unclear—no SPDX identifier or raw license text is recorded in the package metadata. Verify the actual license in the GitHub repository before adopting in proprietary or restricted-license projects. Quickstart: pip install nmslib import nmslib index = nmslib.init(space='l2', method='hnsw') index.addDataPointsFromMatrix(data) index.createIndex() labels, distances = index.knnQuery(query_vector, k=10) Requires a C++ compiler and build tools at install time; pybind11 is a build dependency. Python version support is unspecified in package metadata. Verify before relying: - Exact Python version range supported (requires_python is unspecified in metadata) - Whether the library is suitable for production use at scale (no documented SLA or performance benchmarks in fact sheet) - Specific license terms and any commercial use restrictions - Download volume trend and active user base size ## Package facts - License: not declared (unclear) - Python support: unspecified - Install friction: medium - Maintenance: active - Downloads: 154.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags nearest neighbor search library, similarity search non-metric spaces, approximate nearest neighbors, vector similarity search, metric space indexing, fast similarity matching, nearest neighbor evaluation, similarity-search, approximate-algorithms, vector-indexing [View on SkillFed](https://skillfed.io/packages/nmslib) · [View on PyPI](https://pypi.org/project/nmslib/)