Registry / ai-ml / vicinity

vicinity

JSON →
library0.4.4pypypi✓ verified 81d ago

Vicinity is a lightweight nearest-neighbor retrieval library supporting multiple backends (NumPy, Faiss, HNSWlib, PyTorch, etc.) with a scikit-learn-like API. Version 0.4.4, actively maintained, with monthly releases.

pip install vicinity
INSTALL
IMPORT
SIG · VICINITY
V
vicinity
ai-mlpythonv0.4.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Vicinity
from vicinity import Vicinity
from vicinity import NearestNeighbors
Backend
from vicinity import Backend
Metric
from vicinity import Metric

Create random 100x64 float32 array, fit a NearestNeighbors instance with NumPy backend, query nearest 5 neighbors for first 3 vectors.

import numpy as np from vicinity import NearestNeighbors, Backend vectors = np.random.random((100, 64)).astype(np.float32) nn = NearestNeighbors(backend=Backend.NUMPY, metric='cosine') nn.fit(vectors) distances, indices = nn.kneighbors(vectors[:3], k=5) print(distances)
Debug
Known issues
breakingIn v0.4.0, the import path for NearestNeighbors changed from `vicinity.neighbors.NearestNeighbors` to `vicinity.NearestNeighbors`. Old imports will break.
fix
Use `from vicinity import NearestNeighbors`.
affects: <0.4.0
breakingThe Backend enum was moved from `vicinity.backends` to top-level in v0.4.0.
fix
Use `from vicinity import Backend`.
affects: <0.4.0
gotchaInput vectors must be dtype float32 for most backends. If you pass float64, it may be silently converted or raise an error, depending on backend.
fix
Ensure vectors are np.float32: `vectors = np.array(vectors, dtype=np.float32)`.
affects: all
deprecatedThe `vicinity.datasets` module and `load_dataset` function are deprecated in v0.4.2 and will be removed in v0.5.0. Use external libraries like torchvision or sklearn.datasets instead.
fix
Replace `from vicinity.datasets import load_dataset` with manual dataset loading from appropriate sources.
affects: >=0.4.2
Upgrade
Version history
0.4.4latest on PyPI · released Apr 14, 2026
Audit
Dependencies
numpyrequiredRequired for all backends.
faiss-cpuoptionalOptional Faiss backend.
hnswliboptionalOptional HNSWlib backend.
torchoptionalOptional PyTorch backend.
Agent activity
60 hits · last 30 days
node
55
Resources
vicinity — pip install vicinity · libregistry