# LangChain Python setup

`pip install -U langchain` gives you the core: agents, messages, tools, chat models, embeddings. It needs Python 3.10 or newer.

## Provider packages are separate

Model providers live in their own packages. Install the ones you use:

```
pip install -U langchain-openai
pip install -U langchain-anthropic
```

Or pull a provider in as an extra of the core package:

```
pip install -U "langchain[openai]"
pip install -U "langchain[anthropic]"
```

## Rules

- Do not expect `pip install langchain` to include OpenAI or Anthropic support. If the import of `langchain_openai` fails, the fix is installing the provider package, not reinstalling langchain.
- Keep the key in the environment (OPENAI_API_KEY, ANTHROPIC_API_KEY). The model classes read it from there by default; do not hardcode it in the script.
- Use `uv add langchain` / `uv add langchain-openai` if the project is uv-managed. Mixing pip and uv in one project is how you get two copies of langchain-core fighting each other.