ModuleNotFoundError: No module named 'langchain_community'
LangChain split into several packages, and community integrations no longer install with the core. pip install langchain-community — or better, the specific partner package you need.
Updated
The error
ModuleNotFoundError: No module named 'langchain_community'
What it means
LangChain reorganised from one monolithic package into a family: langchain-core (interfaces), langchain (chains and agents), langchain-community (third-party integrations), and per-provider partner packages like langchain-openai. Since the 0.2 line, installing langchain does not bring langchain-community along. Your code — or a tutorial's code — imports from a package that is not installed.
Why it happens
Most tutorials were written when everything shipped together. Code like from langchain_community.vectorstores import FAISS worked after a bare pip install langchain in the old world, and fails in the new one. The split was deliberate: hundreds of integrations forced everyone to install everything and made version conflicts constant.
How to fix it
1. Install the missing package.
pip install -U langchain-communityThat resolves the import as written. Restart the kernel if you are in a notebook.
2. Prefer partner packages for the major providers. The community package is a grab-bag; heavily used integrations moved into dedicated packages that are better maintained:
pip install langchain-openai langchain-anthropic langchain-chroma langchain-huggingfacefrom langchain_openai import ChatOpenAI, OpenAIEmbeddings
from langchain_anthropic import ChatAnthropic
from langchain_chroma import ChromaWhen an import exists in both places, the partner package is the current one — community versions of moved integrations emit deprecation warnings pointing at their new home.
3. Keep the family versions aligned. Mixing an old langchain with a new langchain-core (or vice versa) produces its own import and type errors. Upgrade together:
pip install -U langchain langchain-core langchain-community4. Check which era your tutorial is from. Imports beginning from langchain. for models, embeddings or vector stores mark pre-split code; modern equivalents live in langchain_community. or partner packages. The related page below maps the moved names.
How to prevent it
Pin the LangChain family together in requirements, and treat any LangChain upgrade as a family event. When starting new RAG projects, take imports from the current LangChain docs rather than from tutorials — this ecosystem moves faster than its educational content.
Related errors
- ImportError: cannot import name 'OpenAI' from 'langchain' — the moved-imports map
- No module named 'llama_index' — the same split in LlamaIndex
- BaseSettings has been moved to pydantic-settings
- ModuleNotFoundError: No module named 'torch' — when the problem is the environment, not the package