Python no module named 'yahoofinancials'

Issue

I write this code:

import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
from yahoofinancials import YahooFinancials


yahoo_finance = YahooFinancials(str(stock))
stats=(yahoo_finance.get_historical_price_data("2010-01-01", "2021-04-30", "daily"))

I am already install yahoo-finance1.4.0, yahoofinancials1.6 , yfinance0.1.59 anslo try this

Enter the following four lines in sequence, and execute once for each line:

pip install yahoo-finance
 
git clone git://github.com/lukaszbanasiak/yahoo-finance.git
 
cd yahoo-finance
 
python setup.py install

But still, it’s show error "No module named ‘yahoofinancials’"

I already check this code ">pip show yahoofinancials" and get this info

Name: yahoofinancials
Version: 1.6
Summary: A powerful financial data module used for pulling both fundamental and technical data from Yahoo Finance
Home-page: https://github.com/JECSand/yahoofinancials
Author: Connor Sanders
Author-email: [email protected]
License: MIT
Location: c:\users\user\stockspredct\lib\site-packages
Requires: beautifulsoup4, pytz
Required-by:

Please help me how I can fix this error

Solution

It should work the way you are using it. The possible issue may be the environmental change. By looking at the location of the yahoofinancials library in pip, I think you installed it in Virtual Environment and maybe your other libraries are in your global environment. Check if you have activated your virtual environment or try installing yahoofinancials in the global environment.

Answered By – Akshay Goyal

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published