How to Install langchain in Python
Building applications with LLMs through composability
pip install langchain
What is langchain?
Building applications with LLMs through composability
Looking for the JS/TS version? Check out LangChain.js.
To help you ship LangChain apps to production faster, check out LangSmith. LangSmith is a unified developer platform for building, testing, and monitoring LLM applications.
LangChain is the easiest way to start building agents and applications powered by LLMs. With under 10 lines of code, you can connect to OpenAI, Anthropic, Google, and more. LangChain provides a pre-built agent architecture and model integrations to help you get started quickly and seamlessly incorporate LLMs into your agents and applications.
Quick Start
Minimal example to get started with langchain:
import langchain
print(langchain.__version__)
Installation
pip (standard)
pip install langchain
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install langchain
pip3
pip3 install langchain
conda
conda install -c conda-forge langchain
Poetry
poetry add langchain
Dependencies
Installing langchain will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import langchain; print(langchain.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing langchain with pip.
ModuleNotFoundError: No module named 'langchain'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install langchain. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'langchain' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install langchain to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'langchain'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show langchain and upgrade with pip install --upgrade langchain.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install langchain. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user langchain
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org langchain
MemoryError when loading data
Cause: Dataset is too large to fit in RAM.
Fix: Read in chunks, filter columns on load, or consider Polars/Dask for out-of-core processing.
Recent Releases
| Version | Released |
|---|---|
1.2.15 latest |
2026-04-03 |
1.2.14 |
2026-03-31 |
1.2.13 |
2026-03-19 |
1.2.12 |
2026-03-11 |
1.2.11 |
2026-03-10 |
Manage langchain
Upgrade to latest version
pip install --upgrade langchain
Install a specific version
pip install langchain==1.2.15
Uninstall
pip uninstall langchain
Check what is installed
pip show langchain