langchain - 💡(How to fix) Fix ModuleNotFoundError: No module named 'langchain.chains' on fresh install [4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#35240Fetched 2026-04-08 00:27:01
View on GitHub
Comments
4
Participants
3
Timeline
17
Reactions
0
Author
Timeline (top)
commented ×4labeled ×4mentioned ×3subscribed ×3

langchain installs successfully, Importing langchain works, langchain.chains module is missing at runtime which i don't expect, i am working with python3.11.9 and 3.13 (venv) on windows 11 and i am currently using pip

Error Message

ModuleNotFoundError: No module named 'langchain.chains

Root Cause

langchain installs successfully, Importing langchain works, langchain.chains module is missing at runtime which i don't expect, i am working with python3.11.9 and 3.13 (venv) on windows 11 and i am currently using pip

Fix Action

Fix / Workaround

  • 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 posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Other Dependencies

aiohttp: 3.13.3 dataclasses-json: 0.6.7 groq: 0.37.1 httpx: 0.28.1 httpx-sse: 0.4.3 huggingface-hub: 0.36.2 jsonpatch: 1.33 langgraph: 1.0.8 numpy: 2.4.2 opentelemetry-api: 1.39.1 opentelemetry-sdk: 1.39.1 orjson: 3.11.7 packaging: 26.0 pydantic: 2.12.5 pydantic-settings: 2.13.0 PyYAML: 6.0.3 pyyaml: 6.0.3 requests: 2.32.5 requests-toolbelt: 1.0.0 rich: 14.3.2 sentence-transformers: 5.2.2 sqlalchemy: 2.0.46 SQLAlchemy: 2.0.46 tenacity: 9.1.4 tokenizers: 0.22.2 transformers: 5.1.0 typing-extensions: 4.15.0 uuid-utils: 0.14.0 xxhash: 3.6.0 zstandard: 0.25.0

Code Example

from langchain.chains import create_retrieval_chain
from langchain.chains.combine_documents import create_stuff_documents_chain

---

ModuleNotFoundError: No module named 'langchain.chains
RAW_BUFFERClick to expand / collapse

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 posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-perplexity
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Related Issues / PRs

No response

Reproduction Steps / Example Code (Python)

from langchain.chains import create_retrieval_chain
from langchain.chains.combine_documents import create_stuff_documents_chain

Error Message and Stack Trace (if applicable)

ModuleNotFoundError: No module named 'langchain.chains

Description

langchain installs successfully, Importing langchain works, langchain.chains module is missing at runtime which i don't expect, i am working with python3.11.9 and 3.13 (venv) on windows 11 and i am currently using pip

System Info

System Information

OS: Windows OS Version: 10.0.26200 Python Version: 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]

Package Information

langchain_core: 1.2.13 langchain: 1.2.10 langchain_community: 0.4.1 langsmith: 0.7.3 langchain_classic: 1.0.1 langchain_groq: 1.1.2 langchain_huggingface: 1.2.0 langchain_text_splitters: 1.1.0 langgraph_sdk: 0.3.6

Optional packages not installed

langserve

Other Dependencies

aiohttp: 3.13.3 dataclasses-json: 0.6.7 groq: 0.37.1 httpx: 0.28.1 httpx-sse: 0.4.3 huggingface-hub: 0.36.2 jsonpatch: 1.33 langgraph: 1.0.8 numpy: 2.4.2 opentelemetry-api: 1.39.1 opentelemetry-sdk: 1.39.1 orjson: 3.11.7 packaging: 26.0 pydantic: 2.12.5 pydantic-settings: 2.13.0 PyYAML: 6.0.3 pyyaml: 6.0.3 requests: 2.32.5 requests-toolbelt: 1.0.0 rich: 14.3.2 sentence-transformers: 5.2.2 sqlalchemy: 2.0.46 SQLAlchemy: 2.0.46 tenacity: 9.1.4 tokenizers: 0.22.2 transformers: 5.1.0 typing-extensions: 4.15.0 uuid-utils: 0.14.0 xxhash: 3.6.0 zstandard: 0.25.0

extent analysis

Fix Plan

Problem: Missing langchain.chains module at runtime

Solution:

  1. Update langchain package: Run the following command in your terminal:

pip install --upgrade langchain

2. **Verify `langchain` package version**: After updating, verify that the `langchain` package version is greater than `1.2.10`. You can check this by running:
   ```bash
pip show langchain
  1. Check for conflicts: If you're using a virtual environment, ensure that there are no conflicts between the langchain package versions in your virtual environment and the global Python environment.
  2. Reinstall langchain package: If the issue persists, try reinstalling the langchain package by running:

pip uninstall langchain pip install langchain


### Verification

1. **Re-run your Python script**: After updating the `langchain` package, re-run your Python script to verify that the `langchain.chains` module is available.
2. **Check for error messages**: If the issue persists, check for any error messages that may indicate a conflict or a missing dependency.

### Extra Tips

* Ensure that you're using the latest version of Python and pip.
* If you're using a virtual environment, ensure that it's properly activated before installing packages.
* If you're still experiencing issues, try reinstalling the `langchain` package and its dependencies.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING