You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched the LangChain documentation with the integrated search.
I used the GitHub search to find a similar question and didn't find it.
I am sure that this is a bug in LangChain rather than my code.
The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
I'm creating the LanceDB table and passing it to the LanceDB vectorstore constructor, like this:
importlancedbfromlangchain_community.vectorstoresimportLanceDB# Set this to point to an existing LanceDB vectorstoreuri='s3://my-bucket/path/to/db'connection=lancedb.connect(uri)
lance_table=connection.open_table('vectorstore')
vectorstore=LanceDB(
embedding=OpenAIEmbeddings() # or whatever the correct class is for the vectorstoremode="append",
connection=connection,
table=lance_table,
)
Error Message and Stack Trace (if applicable)
File "/Users/ppatterson/src/ai-rag-app-part-1/ai_rag_app/utils/vectorstore.py", line 57, in open_vectorstore_and_table
vectorstore = LanceDB(
embedding=OpenAIEmbeddings()
...<2 lines>...
table=lance_table,
)
File "/Users/ppatterson/src/ai-rag-app-part-1/.venv/lib/python3.13/site-packages/langchain_community/vectorstores/lancedb.py", line 131, in __init__
table, (lancedb.db.LanceTable, lancedb.remote.table.RemoteTable)
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'lancedb.remote' has no attribute 'table'
Description
I'm creating the LanceDB table in my code, so that I can query it before adding documents.
I expect to be able to create a connection and table, just as the LanceDB vectorstore does, and pass them to the vectorstore constructor
Instead, the vectorstore constructor raises an AttributeError, since it has imported lancedb, but this doesn't import lancedb.remote.table
The fix is to add another import after the existing one:
"""Initialize with Lance DB vectorstore"""
lancedb = guard_import("lancedb") # existing import
lancedb.remote.table = guard_import("lancedb.remote.table") # add this one
I can submit a PR.
System Info
System Information
OS: Darwin
OS Version: Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000
Python Version: 3.13.1 (main, Feb 25 2025, 10:24:37) [Clang 16.0.0 (clang-1600.0.26.6)]
aiohttp<4.0.0,>=3.8.3: Installed. No version info available.
async-timeout<5.0.0,>=4.0.0;: Installed. No version info available.
dataclasses-json<0.7,>=0.5.7: Installed. No version info available.
filetype: 1.2.0
google-ai-generativelanguage: 0.6.16
httpx: 0.28.1
httpx-sse<1.0.0,>=0.4.0: Installed. No version info available.
jsonpatch<2.0,>=1.33: Installed. No version info available.
langchain-anthropic;: Installed. No version info available.
langchain-aws;: Installed. No version info available.
langchain-cohere;: Installed. No version info available.
langchain-community;: Installed. No version info available.
langchain-core<1.0.0,>=0.3.34: Installed. No version info available.
langchain-core<1.0.0,>=0.3.39: Installed. No version info available.
langchain-core<1.0.0,>=0.3.41: Installed. No version info available.
langchain-deepseek;: Installed. No version info available.
langchain-fireworks;: Installed. No version info available.
langchain-google-genai;: Installed. No version info available.
langchain-google-vertexai;: Installed. No version info available.
langchain-groq;: Installed. No version info available.
langchain-huggingface;: Installed. No version info available.
langchain-mistralai;: Installed. No version info available.
langchain-ollama;: Installed. No version info available.
langchain-openai;: Installed. No version info available.
langchain-text-splitters<1.0.0,>=0.3.6: Installed. No version info available.
langchain-together;: Installed. No version info available.
langchain-xai;: Installed. No version info available.
langchain<1.0.0,>=0.3.20: Installed. No version info available.
langsmith-pyo3: Installed. No version info available.
langsmith<0.4,>=0.1.125: Installed. No version info available.
langsmith<0.4,>=0.1.17: Installed. No version info available.
numpy<3,>=1.26.2: Installed. No version info available.
ollama: 0.4.7
openai<2.0.0,>=1.58.1: Installed. No version info available.
orjson: 3.10.15
packaging: 24.2
packaging<25,>=23.2: Installed. No version info available.
pydantic: 2.10.6
pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available.
pydantic<3.0.0,>=2.5.2;: Installed. No version info available.
pydantic<3.0.0,>=2.7.4: Installed. No version info available.
pydantic<3.0.0,>=2.7.4;: Installed. No version info available.
pytest: Installed. No version info available.
PyYAML>=5.3: Installed. No version info available.
requests: 2.32.3
requests-toolbelt: 1.0.0
requests<3,>=2: Installed. No version info available.
rich: Installed. No version info available.
SQLAlchemy<3,>=1.4: Installed. No version info available.
tenacity!=8.4.0,<10,>=8.1.0: Installed. No version info available.
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
tiktoken<1,>=0.7: Installed. No version info available.
typing-extensions>=4.7: Installed. No version info available.
zstandard: 0.23.0
The text was updated successfully, but these errors were encountered:
**Description:**
This PR adds a call to `guard_import()` to fix an AttributeError raised
when creating LanceDB vectorstore instance with an existing LanceDB
table.
**Issue:**
This PR fixes issue #30124.
**Dependencies:**
No additional dependencies.
**Twitter handle:**
[@metadaddy](https://x.com/metadaddy), but I spend more time at
[@metadaddy.net](https://bsky.app/profile/metadaddy.net) these days.
---------
Co-authored-by: Chester Curme <[email protected]>
Checked other resources
Example Code
I'm creating the LanceDB table and passing it to the LanceDB vectorstore constructor, like this:
Error Message and Stack Trace (if applicable)
Description
AttributeError
, since it has importedlancedb
, but this doesn't importlancedb.remote.table
The fix is to add another import after the existing one:
I can submit a PR.
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
The text was updated successfully, but these errors were encountered: