Repository navigation
Conversation
Author
|
Bump - this one has no reviewer assigned yet. It fixes #22619: |
wguo7
force-pushed
the
fix/lancedb-declare-pandas
branch
from
September 9, 2026 01:13
9e3bff9 to
0491b23
Compare
This was referenced Sep 28, 2026
llama-index-vector-stores-lancedb imported pandas at module level but never declared it in [project].dependencies, so the package failed to import in any clean environment (ModuleNotFoundError: No module named 'pandas'). CI never caught it because the dev dependency group installs pandas into the test env; user installs were masked until llama-index 0.14.18 slimmed the metapackage and stopped pulling readers-file (which requires pandas) transitively. Remove the pandas usage instead of declaring it: fetch results with LanceDB's native to_list() (list of row dicts) rather than to_pandas(), iterate dicts in get_nodes()/query(), and rewrite _to_llama_similarities over a list of dicts with the same normalization math. to_list() exists across the entire supported range (lancedb>=0.21.1). Bump version to 0.6.1. Fixes run-llama#22619
wguo7
force-pushed
the
fix/lancedb-declare-pandas
branch
from
October 31, 2026 14:33
0491b23 to
885e411
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
llama-index-vector-stores-lancedbcannot be imported in a clean environment:Root cause:
base.pyused pandas at runtime (module-levelfrom pandas import DataFrame,.to_pandas()inget_nodes()/query(), DataFrame-based_to_llama_similarities), butpyproject.tomlnever declared pandas in[project].dependencies— and none of the declared deps (lancedb,pylance,tantivy,llama-index-core) requires pandas at runtime (lancedb carries it only in itstestsextra across the whole supported range; verified 0.21.1 → 0.36.0). CI never caught it because the dev dependency group installspandas>=2.2.3into the uv-locked test env.Why it surfaces now: until
llama-index0.14.16 the metapackage masked the bug by transitively pullingllama-index-readers-file(which hard-requires pandas). The slimmed metapackage (0.14.18+) dropped it, so since March evenpip install llama-index llama-index-vector-stores-lancedbfails at import in a clean env. Minimal installs (llama-index-core+ this integration) have been broken the whole time.Fix: per the discussion on #22619, remove the pandas dependency entirely rather than declare it:
.to_list()(list of row dicts; implemented upstream asto_arrow().to_pylist()) instead of.to_pandas()—to_list()exists across the entire supported range (present in lancedb 0.21.1, the version floor)item["metadata"],item["id"]) instead ofDataFrame.iterrows()attribute access_to_llama_similaritiesoperates on the list of dicts with the same normalization math (softmax-style overscore,exp(-_distance), linspace fallback), plus an explicit[]return for empty inputidscome from a list comprehension instead ofresults["id"].tolist()Struct columns (metadata) arrive as dicts and vector columns as lists from
to_pylist(), sometadata_dict_to_node(...)and the embedding extraction behave identically; on a row missing themetadatakey the legacy-fallback branch raisesKeyErrorwhere it previously raisedAttributeError— same uncaught crash class, no silent behavior change.This drops a heavy transitive dependency from the integration and fixes the clean-env import break at the root.
Fixes #22619
New Package?
Version Bump?
Type of Change
How Has This Been Tested?
All runs on Windows 11 / Python 3.13.9, package installed editable, pandas verifiably absent (
import pandas→ModuleNotFoundError) in both environments:Latest deps (fresh resolve: lancedb 0.36.0, pylance 10.0.0, llama-index-core 0.14.23):
Lockfile-pinned deps (lancedb 0.30.2, pylance 6.0.0, llama-index-core 0.14.21):
LanceDB is embedded, so this is the complete suite — no server-gated skips. Version floor compatibility:
to_list()is present in lancedb 0.21.1 (lancedb/query.py, sync and async builders).Pre-fix, the import failure reproduces in any clean venv as described in #22619 (also reproduced with deps pinned to the uv.lock versions — the break is version-independent, an undeclared-dependency bug rather than a lancedb regression).
Not covered: LanceDB Cloud/remote-table (
db://) paths (no credentials available);to_list()is part of the same query-builder surface remote tables expose, but CI/reviewers with cloud access may want to confirm.Suggested Checklist:
ruff check/ruff format(pinned 0.11.11) on the changed files