need to %pip install langchain_experimental for
create_python_agent and PythonREPLTool
symptom:
For
from langchain.agents.agent_toolkits import create_python_agent
I get this message:
ImportError: create_python_agent has been moved to langchain experimental. See PythonRepl tools and Pandas/Xorbits/Spark/Python agents are moving to langchain_experimental · langchain-ai/langchain · Discussion #11680 · GitHub more information.
Please update your import statement from: langchain.agents.agent_toolkits.create_python_agent
to langchain_experimental.agents.agent_toolkits.create_python_agent
.
For
from langchain_experimental.agents.agent_toolkits import create_python_agent
I get this message
ModuleNotFoundError: No module named ‘langchain_experimental’
Hi, Mho.
Notice that you posted this under DLS Course 3 - Structuring Machine Learning Projects, but that is not a programming course. There are only quizzes, no programming assignments in DLS C3. I’m guessing that you are asking about one of the LLM based courses. It would help get the thread noticed by the mentors for those courses if you change the category to the appropriate specialization and/or course. You can use the little “edit pencil” on the title to move it.
Sorry, I am familiar with DLS, but can’t help with langchain related issues.
Regards,
Paul
Thanks Paul, sorry about that. I fixed the categorization. Maybe when I grow up I can contribute an AI to auto-categorize these posts.
Hi, I have the same error.
- The lab is “L6-Agents”.
- It happens running it locally, on the platform didn’t throw errors.
Could be some version issues?
Hello @Mobsi
The Lab is L6-Agents and I am running it locally. same as @rafanegrette.
It works when I did a %pip install langchain_experimental . maybe this moved after they generated that tutorial.
Best
Mho
Thank you, that worked (pip install langchain_experimental).