{"id":22964,"library":"voyager","title":"Voyager","description":"Voyager is an approximate nearest neighbor search library optimized for speed and memory, supporting both L2 and cosine distance. It provides Python, Java, and C++ bindings. Current version: 2.1.1, released 2025-01-13. Release cadence: irregular, with multiple minor/patch releases per year.","status":"active","version":"2.1.1","language":"python","source_language":"en","source_url":"https://github.com/spotify/voyager","tags":["ann","approximate-nearest-neighbor","vector-search","spotify"],"install":[{"cmd":"pip install voyager","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Required for vector operations","package":"numpy","optional":false}],"imports":[{"note":"Index is a class in the voyager module, not a submodule.","wrong":"import voyager.Index","symbol":"Index","correct":"from voyager import Index"},{"note":"","wrong":null,"symbol":"Space","correct":"from voyager import Space"}],"quickstart":{"code":"import numpy as np\nfrom voyager import Index, Space\n\n# Create an index with L2 distance\nindex = Index(Space.L2, num_dimensions=3)\n# Add items (vectors and optional IDs)\nvectors = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]], dtype=np.float32)\nindex.add_items(vectors, ids=[0, 1])\n# Query\nquery = np.array([1.5, 2.5, 3.5], dtype=np.float32)\ndistances, ids = index.query(query, k=2)\nprint(ids)  # [0, 1]","lang":"python","description":"Basic example: create index, add vectors, query nearest neighbors."},"warnings":[{"fix":"Ensure input vectors are np.float32 to avoid conversion overhead.","message":"Voyager uses float32 internally; passing float64 vectors will cause silent conversion and may affect performance.","severity":"gotcha","affected_versions":"all"},{"fix":"Use Space.L2 instead of 'l2' or 0.","message":"The 'Space' enumeration values (e.g., Space.L2, Space.Cosine) are preferred over the older string-based distance specification.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Always unpack as distances, ids = index.query(...).","message":"Index.query returns (distances, ids) tuples; it is easy to forget the order and assume (ids, distances).","severity":"gotcha","affected_versions":"all"},{"fix":"If you use custom Python objects for IDs, ensure they are convertible to int64. Review migration notes.","message":"In v2.1.0, the Python bindings were migrated to Nanobind; this may affect how custom data types or callbacks are passed.","severity":"breaking","affected_versions":"2.1.0 and later"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'pip install voyager' (not 'voyager-search' or 'voyager-ann').","cause":"Voyager is not installed or the wrong package name is used.","error":"ModuleNotFoundError: No module named 'voyager'"},{"fix":"Use Index(Space.L2, num_dimensions=3).","cause":"Incorrect argument name; constructor expects 'num_dimensions' (old versions used 'd' or 'dimension').","error":"TypeError: __init__() got an unexpected keyword argument 'num_dimensions'"},{"fix":"Use 'from voyager import Index'.","cause":"Importing from a submodule instead of the top-level package.","error":"AttributeError: module 'voyager' has no attribute 'Index'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}