Diagnose: ModuleNotFoundError: No module named 'langchain_openai'
Symptom: the traceback names a langchain provider package. Confirm it is really missing, install it, and verify the import. Two minutes, no guessing.
Symptom
ModuleNotFoundError: No module named 'langchain_openai'(Or langchain_anthropic, langchain_chroma, any langchain_* provider package.)
Confirm
Run pip show langchain-openai. If it prints nothing, the package is genuinely absent. Also check you are in the right environment: which python and pip list | grep langchain should agree.
Cause
LangChain splits every provider into its own package. pip install langchain never includes them. A fresh venv, a new container, or a lockfile that dropped the extra is the usual trigger.
Fix
pip install -U langchain-openaiuv-managed project? Use uv add langchain-openai. Do not mix pip and uv.
Verify
from langchain_openai import ChatOpenAI
print("ok")If the import works, done. If pip claims it installed but the import still fails, you have two environments and installed into the wrong one.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.
You’re reading an older version. View current skill →