Skip to content

ModuleNotFoundError: No module named 'langchain.chains' #33822

Description

@xyfleet

Checked other resources

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • 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).
  • This is not related to the langchain-community package.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Example Code

The following code:

from langchain.chains.query_constructor.schema import AttributeInfo

Error Message and Stack Trace (if applicable)

The error message:


ModuleNotFoundError Traceback (most recent call last)
Cell In[4], line 3
1 # from langchain_community.chains.query_constructor.schema import AttributeInfo
2 # from langchain_classic.chains import AttributeInfo
----> 3 from langchain.chains.query_constructor.schema import AttributeInfo
4 from langchain.retrievers.self_query.base import SelfQueryRetriever
5 from langchain_openai import ChatOpenAI

ModuleNotFoundError: No module named 'langchain.chains'

Description

I am build a self-query in RAG based on the link, https://github.com/langchain-ai/langchain/blob/v0.3/docs/docs/how_to/self_query.ipynb
Hit an error when I tried to import
from langchain.chains.query_constructor.schema import AttributeInfo

Below is the version I am using for now:
Name: langchain Version: 1.0.2 Name: langchain-core Version: 1.0.1

System Info

System Information

OS: Darwin
OS Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:34 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8103
Python Version: 3.11.7 (v3.11.7:fa7a6f2303, Dec 4 2023, 15:22:56) [Clang 13.0.0 (clang-1300.0.29.30)]

Package Information

langchain_core: 1.0.3
langchain: 1.0.3
langchain_community: 0.4.1
langsmith: 0.4.26
langchain_anthropic: 0.3.19
langchain_chroma: 0.2.6
langchain_classic: 1.0.0
langchain_google_genai: 3.0.0
langchain_google_vertexai: 3.0.1
langchain_openai: 0.3.34
langchain_text_splitters: 1.0.0
langchain_yt_dlp: 0.0.8
langchainhub: 0.1.21
langgraph_sdk: 0.2.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugRelated to a bug, vulnerability, unexpected error with an existing featureexternal

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions