{"record":{"id":"76bcff9326ecafb7","repo":"cocoindex-io/cocoindex","slug":"lancedb-and-pyarrow-are-required-to-use-the-lanced","errorCode":null,"errorMessage":"lancedb and pyarrow are required to use the LanceDB connector. Please install cocoindex[lancedb].","messagePattern":"lancedb and pyarrow are required to use the LanceDB connector\\. Please install cocoindex\\[lancedb\\]\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/connectors/lancedb/_target.py","lineNumber":33,"sourceCode":"from typing import (\n    Any,\n    Callable,\n    Collection,\n    Generic,\n    Literal,\n    NamedTuple,\n    Sequence,\n    cast,\n)\n\nfrom typing_extensions import TypeVar\n\ntry:\n    import lancedb  # type: ignore\n    import lancedb.index as lancedb_index  # type: ignore\n    import pyarrow as pa  # type: ignore\nexcept ImportError as e:\n    raise ImportError(\n        \"lancedb and pyarrow are required to use the LanceDB connector. Please install cocoindex[lancedb].\"\n    ) from e\n\nfrom lancedb.db import AsyncConnection as LanceAsyncConnection  # type: ignore\n\nimport numpy as np\n\nimport cocoindex as coco\nfrom cocoindex.connectorkits import statediff, target\nfrom cocoindex.connectorkits.fingerprint import fingerprint_object\nfrom cocoindex._internal.datatype import (\n    AnyType,\n    MappingType,\n    SequenceType,\n    RecordType,\n    TypeChecker,\n    UnionType,\n    analyze_type_info,","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/lancedb/_target.py#L15-L51","documentation":"Importing the LanceDB target connector module fails because the optional packages lancedb and/or pyarrow are missing. CocoIndex raises an ImportError at module import with guidance to install the cocoindex[lancedb] extra.","triggerScenarios":"Any import of python/cocoindex/connectors/lancedb/_target.py (or the lancedb connectors package) when `import lancedb`, `import lancedb.index`, or `import pyarrow` raises ImportError.","commonSituations":"Installing cocoindex without [lancedb]; partial environments where pyarrow is present but lancedb is not (or vice versa); broken lancedb/pyarrow installs that fail on import.","solutions":["Install the extra: `pip install 'cocoindex[lancedb]'`.","If partially installed, ensure both packages import: `python -c \"import lancedb, pyarrow\"`; reinstall whichever fails.","Pin compatible lancedb/pyarrow versions if a recent lancedb broke the import."],"exampleFix":"// before\nfrom cocoindex.connectors.lancedb import LanceDBTarget  # ImportError at import time\n// after\n# pip install 'cocoindex[lancedb]'\nfrom cocoindex.connectors.lancedb import LanceDBTarget","handlingStrategy":"try-catch","validationCode":"try:\n    import lancedb, pyarrow  # noqa: F401\nexcept ImportError:\n    raise SystemExit(\"Install the LanceDB extra: pip install 'cocoindex[lancedb]'\")","typeGuard":null,"tryCatchPattern":"try:\n    from cocoindex.connectors.lancedb import LanceDbTarget\nexcept ImportError as e:\n    if \"lancedb\" in str(e) or \"pyarrow\" in str(e):\n        raise SystemExit(\"Install: pip install 'cocoindex[lancedb]'\") from e\n    raise","preventionTips":["Use the cocoindex[lancedb] extra rather than installing lancedb manually.","Keep lancedb and pyarrow versions in the same lockfile.","CI smoke-test the import before deployment."],"tags":["python","lancedb","pyarrow","optional-dependency","import-error"],"backgroundTag":"missing-optional-dependency","analyzedSha":"e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b","analyzedAt":"2026-09-08T15:59:19.997Z","contentChangedAt":"2026-09-08T15:59:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}