RyanCodrai/turbovec · error · ImportError

langchain-core is required to use turbovec.langchain. Instal

Error message

langchain-core is required to use turbovec.langchain. Install with: pip install turbovec[langchain]

What it means

Module-level ImportError raised when turbovec.langchain is imported without langchain-core installed. The try/except around the langchain_core imports converts the raw ModuleNotFoundError into a named error with the correct extra-install command, failing at import time instead of mid-use.

Source

Thrown at turbovec-python/python/turbovec/langchain.py:49

import numpy as np

from ._dedup import DuplicatePolicy, resolve_duplicates
from ._persist import (
    check_persisted_handles,
    check_schema_version,
    check_sidecar_keysets,
)
from ._similarity import COSINE, DOT_PRODUCT, l2_normalize_rows, validate_similarity
from ._turbovec import IdMapIndex
from ._persist import atomic_save  # isort:skip

try:
    from langchain_core.documents import Document
    from langchain_core.embeddings import Embeddings
    from langchain_core.vectorstores import VectorStore
except ImportError as exc:
    raise ImportError(
        "langchain-core is required to use turbovec.langchain. "
        "Install with: pip install turbovec[langchain]"
    ) from exc


_INDEX_FILENAME = "index.tvim"
_STORE_FILENAME = "docstore.json"
# Bump when the docstore.json shape changes; loader accepts the current
# version plus any older versions whose missing fields we know how to
# reconstruct (v1 predates the `similarity` field — those stores hold
# raw, unnormalized vectors, so they load in "dot_product" mode, which
# is exactly the scoring they were written under).
_DOCSTORE_SCHEMA_VERSION = 2
_DOCSTORE_SCHEMA_COMPAT = (1, 2)


class TurboQuantVectorStore(VectorStore):
    """LangChain VectorStore backed by a :class:`IdMapIndex`.

View on GitHub (pinned to ccab9f325e)

Solutions

  1. Install the extra: pip install turbovec[langchain].
  2. Or install langchain-core directly into the environment.
  3. Avoid importing turbovec.langchain in environments that do not need LangChain integration.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at turbovec-python/python/turbovec/langchain.py:49 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of RyanCodrai/turbovec@ccab9f325e (2026-09-06). Data as JSON: /api/errors/a39a5aae25215d10. Report an issue: GitHub.