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

[BUG] yfinance not installed. Please install using pip install yfinance. #1918

Open
emirhanyagci opened this issue Jan 28, 2025 · 5 comments

Comments

@emirhanyagci
Copy link

Even i already install yfinance i get this error when i try basic example at the doc .

from phi.agent import Agent
from phi.model.google import Gemini
from phi.tools.yfinance import YFinanceTools

finance_agent = Agent(
    name="Finance Agent",
    model=Gemini(id="gemini-2.0-flash-exp"),
    tools=[
        YFinanceTools(
            stock_price=True,
            analyst_recommendations=True,
            company_info=True,
            company_news=True,
        )
    ],
    instructions=["Use tables to display data"],
    show_tool_calls=True,
    markdown=True,
)
finance_agent.print_response("Summarize analyst recommendations for NVDA", stream=True)

By the way i tried to first example and its work perfectly i don't know why thats happening cuz i was face with same issue at crew ai ,I wonder if there could be a problem with the yfinance

pip freeze

annotated-types==0.7.0
anyio==4.8.0
beautifulsoup4==4.12.3
cachetools==5.5.1
certifi==2024.12.14
charset-normalizer==3.4.1
click==8.1.8
colorama==0.4.6
docstring_parser==0.16
duckduckgo_search==7.3.0
frozendict==2.4.6
gitdb==4.0.12
GitPython==3.1.44
google-ai-generativelanguage==0.6.15
google-api-core==2.24.1
google-api-python-client==2.160.0
google-auth==2.38.0
google-auth-httplib2==0.2.0
google-generativeai==0.8.4
googleapis-common-protos==1.66.0
grpcio==1.70.0
grpcio-status==1.70.0
h11==0.14.0
html5lib==1.1
httpcore==1.0.7
httplib2==0.22.0
httpx==0.28.1
idna==3.10
lxml==5.3.0
markdown-it-py==3.0.0
mdurl==0.1.2
multitasking==0.0.11
numpy==2.2.2
ollama==0.4.7
pandas==2.2.3
peewee==3.17.8
phidata==2.7.10
platformdirs==4.3.6
primp==0.11.0
proto-plus==1.26.0
protobuf==5.29.3
pyasn1==0.6.1
pyasn1_modules==0.4.1
pydantic==2.10.6
pydantic-settings==2.7.1
pydantic_core==2.27.2
Pygments==2.19.1
pyparsing==3.2.1
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
pytz==2024.2
PyYAML==6.0.2
requests==2.32.3
rich==13.9.4
rsa==4.9
shellingham==1.5.4
six==1.17.0
smmap==5.0.2
sniffio==1.3.1
soupsieve==2.6
tomli==2.2.1
tqdm==4.67.1
typer==0.15.1
typing_extensions==4.12.2
tzdata==2025.1
uritemplate==4.1.1
urllib3==2.3.0
webencodings==0.5.1
yfinance==0.2.52
@emirhanyagci emirhanyagci changed the title yfinance not installed. Please install using pip install yfinance. [BUG] yfinance not installed. Please install using pip install yfinance. Jan 28, 2025
@sanskaryo
Copy link

Have you checked if you might be running your script in a different Python version or environment than where yfinance is installed? It could lead to version discrepancies. You can verify your Python version and the active environment using python --version and pip list. Additionally, checking the module path with print(yfinance.__file__) could help identify any issues with multiple installations

@dirkbrnd
Copy link
Contributor

Hi @emirhanyagci
It looks like something is up with your virtual env. You can also run which python and see where your python is running from, followed by which pip. Perhaps you are pip-installing to global while python is executing from a virtual environment?

@emirhanyagci
Copy link
Author

Image
this is outputs

@emirhanyagci
Copy link
Author

emirhanyagci commented Jan 30, 2025

And i checked yfinance is available in my agent code still same error i'm confused

from phi.agent import Agent
from phi.model.google import Gemini
from phi.tools.yfinance import YFinanceTools
import yfinance


print(yfinance.__file__)


# finance_agent = Agent(
#     name="Finance Agent",
#     model=Gemini(id="gemini-2.0-flash-exp"),
#     tools=[
#         YFinanceTools(
#             stock_price=True,
#             analyst_recommendations=True,
#             company_info=True,
#             company_news=True,
#         )
#     ],
#     instructions=["Use tables to display data"],
#     show_tool_calls=True,
#     markdown=True,
# )
# finance_agent.print_response("Summarize analyst recommendations for NVDA", stream=True)


# this is not working , yfinance not installed error occurs while try to run . i created issue for this https://github.com/phidatahq/phidata/issues/1918

occurs error : ImportError: yfinance not installed. Please install using pip install yfinance.

@ysolanky
Copy link
Contributor

Hello @emirhanyagci ! This is most certainly an issue with your environment. Can you please run:

python3 -m venv .venv
source .venv/bin/activate
pip install agno openai yfinance
export GOOGLE_API_KEY=***

And then run this example: https://docs.agno.com/tools/toolkits/yfinance

Starting today we have rebranded to Agno. So please update your file to reflect the changes

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

4 participants