Search code examples
pythonlangchain

ModuleNotFoundError: No module named 'langchain.agents'


Just intalled Lanchain. Been going through the first few steps of the getting started tutorial without a problem till I reach the Agents section.

from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.agents import AgentType
from langchain.llms import OpenAI
Traceback (most recent call last):
  File "/langchain/agents.py", line 4, in <module>
    from langchain.agents import load_tools
ModuleNotFoundError: No module named 'langchain.agents'

I am running lanchain in a virtual environment in python 3.9. Installed langchain with the pip install command as shown in the docs.

Not sure why this module specifically could be missing


Solution

  • Switched to python 3.9 version 0.0.135 which seems to have fixed the issue.

    https://pypi.org/project/langchain/0.0.135/