Solution skill
Diagnose: ImportError: cannot import name 'ChatOpenAI' from 'langchain'
Complete solution
Shows how to fix diagnose: ImportError: cannot import name 'ChatOpenAI' from 'langchain'. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For "ImportError: cannot import name 'ChatOpenAI' from 'langchain'": run python -c "import langchain; print(langchain.\\version\\)". `python from langchain\_openai import ChatOpenAI # needs pip install langchain-openai or provider-agnostic: python from langchain.chat\_models import init\_chat\_model model = init\_chat\_model("openai:gpt-5.5")
ImportError: cannot import name 'ChatOpenAI' from 'langchain'Steps
- Run
python -c "import langchain; print(langchain.__version__)". If it is 1.x, the old import path is gone by design, not by accident. - LangChain v1 shrank the
langchainnamespace to agents, messages, tools, chat models (init functions), and embeddings. Model classes moved to provider packages. Training data and old tutorials still teach the pre-v1 paths.
from langchain_openai import ChatOpenAI # needs pip install langchain-openai- or provider-agnostic:
from langchain.chat_models import init_chat_model
model = init_chat_model("openai:gpt-5.5")- Import the class and construct it. Then grep the codebase for other stale imports from
langchain(langchain.chat_modelsclasses,langchain.llms,langchain.embeddingsclasses); they fail the same way and it is cheaper to fix them all now.
When to use
You are seeing this: ` ImportError: cannot import name 'ChatOpenAI' from 'langchain' ` Use this skill when you run into "Diagnose: ImportError: cannot import name 'ChatOpenAI' from 'langchain'".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
LangChain v1 shrank the langchain namespace to agents, messages, tools, chat models (init functions), and embeddings.
Evidence
Diagnostic procedure grounded in the official v1 migration guide, verified 2026-09-26. Migration guide: docsgchain.com/oss/python/migrate/langchain-v1
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_bY3e3FLvrtFrx36ISS57SQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Diagnose: ImportError: cannot import name 'ChatOpenAI' from 'langchain' <span>— Vectle</span></a>