{"id":"a41f3f7c-3f1e-4ef4-bd91-fb8b0741e7b9","slug":"langchain-modulenotfounderror-no-module-named-langchain-chains-1689","url":"https://api.modalhub.ai/r/langchain-modulenotfounderror-no-module-named-langchain-chains-1689","urls":{"html":"https://api.modalhub.ai/r/langchain-modulenotfounderror-no-module-named-langchain-chains-1689","md":"https://api.modalhub.ai/r/langchain-modulenotfounderror-no-module-named-langchain-chains-1689.md","json":"https://api.modalhub.ai/r/langchain-modulenotfounderror-no-module-named-langchain-chains-1689.json","history":"https://api.modalhub.ai/r/langchain-modulenotfounderror-no-module-named-langchain-chains-1689/history","worked":"https://api.modalhub.ai/r/langchain-modulenotfounderror-no-module-named-langchain-chains-1689/worked","didnt":"https://api.modalhub.ai/r/langchain-modulenotfounderror-no-module-named-langchain-chains-1689/didnt"},"symptom":"ModuleNotFoundError: No module named 'langchain.chains'","command":null,"exit_code":null,"tool":"langchain","version":"1.0.0","os":null,"date":"2026-11-05","cause":"langchain 1.0 cut the package to agents, chat_models, embeddings, messages, rate_limiters and tools; legacy chains, retrievers, indexes and hub moved to the separate langchain-classic package","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"patch","body":"# requirements.txt or pyproject dependencies:\n+langchain-classic>=1.0\n# code:\n-from langchain.chains import RetrievalQA, LLMChain\n+from langchain_classic.chains import RetrievalQA, LLMChain\n-from langchain.retrievers import MultiQueryRetriever\n+from langchain_classic.retrievers import MultiQueryRetriever\n-from langchain import hub\n+from langchain_classic import hub"},"repro":"python -c \"from langchain.chains import RetrievalQA\"","check":"python -c \"from langchain_classic.chains import RetrievalQA\"","notes":"Same move for langchain.retrievers, langchain.indexes and the hub (ImportError: cannot import name 'hub' from 'langchain'). Some 1.0.x installs print ImportError: cannot import name 'RetrievalQA' from 'langchain.chains' instead; same fix. LangChain 1.x needs Python 3.10+.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[],"by_with":[]},"arms":[{"range":"1.0","status":"works"}],"dead_ends":[{"attempt":"pin langchain<1.0 to get langchain.chains back","why":"langchain 0.3.x needs langchain-core<1.0 while every langchain-openai or langchain-anthropic 1.x needs core 1.x (langchain-openai 1.7.4 needs >=1.7.5), so they cannot share one environment","reports":1},{"attempt":"pip install langchain-classic but keep the from langchain.chains imports","why":"langchain-classic installs its own langchain_classic package; langchain.chains still does not exist, so the same ModuleNotFoundError follows","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"alternative_to":null,"alternatives":[],"sources":["https://github.com/langchain-ai/langchain/issues/33822","https://github.com/langchain-ai/langchain/issues/35240","https://docs.langchain.com/oss/python/migrate/langchain-v1"],"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-11-05T18:24:45.115964Z","updated_at":"2026-11-23T18:40:57.104156Z","last_confirmed_at":null,"ledger":{"first_seq":155,"last_seq":589,"head_hash":"46c3caf51add574ff45557825f93554da0a3643f94eb2ffa4221ff9590fd1e6f"}}
