LangChain

raw JSON →
1.0.x verified Tue May 12 auth: no python install: verified quickstart: verified

LangChain is an orchestration framework for building LLM-powered applications and agents. It provides abstractions for chaining model calls, tool use, memory, and multi-agent coordination. As of v1.0, LangGraph is the foundational runtime for stateful agent execution.

pip install langchain langchain-openai langchain-anthropic
error ModuleNotFoundError: No module named 'langchain'
cause The 'langchain' module is not installed or is installed in a different Python environment.
fix
Ensure you're using the correct Python environment and install LangChain with 'pip install langchain'.
error ModuleNotFoundError: No module named 'langchain_community'
cause The 'langchain_community' module is not installed.
fix
Install the module using 'pip install langchain-community'.
error ModuleNotFoundError: No module named 'langchain_openai'
cause The 'langchain_openai' module is not installed.
fix
Install the module using 'pip install langchain-openai'.
error ModuleNotFoundError: No module named 'langchain.chains.question_answering'
cause The 'question_answering' module has been deprecated or removed in recent versions of LangChain.
fix
Update your code to use the current modules and functions provided by LangChain for question answering tasks.
error ModuleNotFoundError: No module named 'langchain.vectorstores.neo4j_vector'
cause The 'neo4j_vector' module is not available in the 'langchain.vectorstores' package.
fix
Verify the correct module name and ensure it is available in your installed version of LangChain.
breaking AgentExecutor is removed in v1.0. Use create_agent instead.
fix Replace AgentExecutor with create_agent from langchain
breaking LCEL pipe syntax (prompt | llm | parser) is deprecated. Use explicit chaining.
fix Use create_agent or direct llm.invoke() calls
breaking langchain-community does not follow semver. Breaking changes can occur in minor releases.
fix Pin langchain-community version explicitly in requirements.txt
gotcha pip install langchain alone is insufficient. Provider packages must be installed separately.
fix Always install langchain-openai or langchain-anthropic alongside langchain
deprecated astream_events(version='v1') uses vulnerable serialization. Use v2.
fix astream_events(version='v2')
gotcha OpenAI API key is missing. Set OPENAI_API_KEY environment variable or pass `api_key` directly to the client.
fix Set the OPENAI_API_KEY environment variable or pass `openai_api_key='your_api_key'` to `ChatOpenAI`.
npm install langchain @langchain/openai @langchain/anthropic
runtime status import time mem disk
3.10-alpine 3.81s 39.7MB 103.4M
3.10-slim 2.86s 39.7MB 105M
3.11-alpine 4.85s 42.4MB 104.7M
3.11-slim 4.11s 42.4MB 113M
3.12-alpine 4.30s 41.7MB 102.0M
3.12-slim 4.41s 41.7MB 103M
3.13-alpine 4.20s 42.3MB 101.7M
3.13-slim 4.18s 42.3MB 103M
3.9-alpine 3.63s 40.4MB 127.1M
3.9-slim 3.29s 40.4MB 134M

Minimal LLM call using ChatOpenAI in LangChain 1.0.

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(model='gpt-4o', temperature=0)
response = llm.invoke('What is the capital of France?')
print(response.content)