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

Import issue #1662

Closed
Dishant0210 opened this issue Dec 30, 2024 · 13 comments
Closed

Import issue #1662

Dishant0210 opened this issue Dec 30, 2024 · 13 comments

Comments

@Dishant0210
Copy link

Dishant0210 commented Dec 30, 2024

ImportError: cannot import name 'identity' from 'phi.utils' (C:\Users\Dell\AppData\Local\Programs\Python\Python312\Lib\site-packages\phi\utils_init_.py)
I got the above issue I searched in this repository still didnt' found it
I want to use this function to deploy my agent in phidata playground

@manthanguptaa
Copy link
Contributor

Hey, @Dishant0210 can you update your phidata version using pip install -U phidata? This should resolve the issue.

@mdeepak2021
Copy link

still not working even after running pip install -U phidata, what could be the issue?

@tanmayyyj
Copy link

I went through the source code, the modules are there, but still not working

@mdeepak2021
Copy link

I was able to fix it, I deleted the conda environment and created a new one and it started working. Try this way, it might help

@manthanguptaa
Copy link
Contributor

@mdeepak2021 @tanmayyyj @Dishant0210 can you confirm what Phidata version you are on?

Also can you all share the code so that I can try to replicate it on my end. My guess is that your virtual environment is messed up a little. I will try my best to help you.

@mdeepak2021
Copy link

I am using the latest version of phidata

@manthanguptaa
Copy link
Contributor

@mdeepak2021 can you share the code you are running that is giving this error?

@tanmayyyj
Copy link

@manthanguptaa I am too on the latest version of phidata, using the code snippet from the examples only to check, but not working

from phi.agent import Agent
from phi.tools.duckduckgo import DuckDuckGo

agent = Agent(tools=[DuckDuckGo()], show_tool_calls=True)
agent.print_response("Whats happening in France?", markdown=True)

@tanmayyyj
Copy link

I guess then the problem might be in my venv only, let me try once again.

@Al-Shafi-Github
Copy link

ImportError: cannot import name 'identity' from 'phi.utils' (C:\Users\Dell\AppData\Local\Programs\Python\Python312\Lib\site-packages\phi\utils__init__.py) I got the above issue I searched in this repository still didnt' found it I want to use this function to deploy my agent in phidata playground

Facing the same issue. Waiting for the solution

@neonwuchang
Copy link

Had the same issue. It only appeared after updating to v2.7.6, so I tried uninstalling phidata and then installing v2.7.5 instead. The error no longer occurs... guess I'll wait a while before updating.

@Al-Shafi-Github
Copy link

it's a shame that I accidentally put three underscores ( ___ ) instead of two ( __ ) in
if __name__ == "__main__":

Anyway, I tried both 'v2.7.6' and 'v2.7.5'. Both of them are working fine.

I also faced this issue
ERROR: Error loading ASGI app. Import string "playground.app" must be in format "<module>:<attribute>".

I updated the code a bit:
serve_playground_app("playground:app", port=7777, reload=True)

Now it works fine. [Issue solved]

I would recommend everyone to double-check that you are using the appropriate venv. I think it was the main issue

@manthanguptaa
Copy link
Contributor

Thanks @Al-Shafi-Github for sharing the solution here! I am closing this issue now as this is the correct answer

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

6 participants