Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'create_pandas_dataframe_agent' from partially initialized module 'langchain_experimental.agents' #32

Open
msicilia opened this issue Jan 12, 2025 · 0 comments

Comments

@msicilia
Copy link

I am attempting to use the create_pandas_dataframe_agent function, but I get an import error.

Concretely, using a simple import sentence:

from langchain_experimental.agents import create_pandas_dataframe_agent

I get the error:

ImportError: cannot import name 'create_pandas_dataframe_agent' from partially initialized module 'langchain_experimental.agents' (most likely due to a circular import)...

I have tried to change the import to the following with the same result:

from langchain_experimental.agents.agent_toolkits import create_pandas_dataframe_agent
from langchain_experimental.agents.agent_toolkits.pandas.base import create_pandas_dataframe_agent

My pyproject.toml file contains this:

requires-python = ">=3.12"
dependencies = [
    "langchain-experimental>=0.3.4",
]

In this doc page it says the following:

NOTE: Since langchain migrated to v0.3 you should upgrade langchain_openai and langchain. This would avoid import errors.

But I have tried to do the upgrade and the import error still persists.

I am using MacOS Sequoia 15.1.1 (24B91). Many thanks in advance for any help on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant