Modulenotfounderror: No Module Named 'Yfinance' - Importing Yahoo Finance & Financials to Python

I'm using Mac OS and receiving an error when doing the following:

import pandas as pd
import yfinance as yf
from yahoofinancials import YahooFinancials

ModuleNotFoundError: No module named 'yfinance'

I've checked pip is installed to the latest version & I've done pip list and yfinance is in there.

I have also checked with:

pip show yfinance
Name: yfinance
Version: 0.1.70
Summary: Download market data from Yahoo! Finance API
Home-page: 
Author: Ran Aroussi
Author-email: 
License: Apache
Location: /Library/Frameworks/
Requires: lxml, multitasking, numpy, pandas, requests
Required-by: 
MacBook-Air:~ User$ 

So it's installed and its path is that of Python3 the latest python.

I'd really appreciate any suggestions!

Thanks

[EDIT]

I'm running Spyder from the default Spyder environment.

5

3 Answers

put this one at bigining

!pip install yfinance

1

To install yfinance package with pip:

pip install -i  finance

To install yfinance package with conda:

conda install -c ranaroussi yfinance
1

I had the same error on Linux. Which rectified by forcing reinstall of the package by the following code.

python -m pip install -U --force-reinstall yfinance 

=

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest