yfinance not working - receiving json.decoder.JSONDecodeError
Asked Answered
C

3

5

I am scraping stock market data from yfinance. My code worked perfectly during the last weeks. For some reason, now I am receiving the following error:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

when executing:

import yfinance as yf
tsla_df = yf.download('TSLA', start='2020-01-01', end='2021-01-01', progress=False)

I have read about this error on Stack Overflow, but no one had an appropriate solution to fix the problem. I am wondering because this simple code worked well days ago. So maybe there is a general problem with the yfinance API at the moment? Can anyone confirm or has a solution for this problem?

Coltoncoltsfoot answered 9/7, 2021 at 18:26 Comment(2)
Getting this same error just starting todayGraecize
known issue, links in answer. great time to check prices unless you are short!Graecize
G
5

Issue has been raised with yfinance, you need to upgrade

Follow here

https://github.com/ranaroussi/yfinance/issues/764

from github:

If you're getting an json.decoder.JSONDecodeError related error, please upgrade to yfinance 0.1.62. Upgrade using:

$ pip install yfinance -U--no-cache-dir

Full conversation here : https://github.com/ranaroussi/yfinance/issues/760

I couldn't get the fix to work but this comment worked for me https://github.com/ranaroussi/yfinance/issues/760#issuecomment-877379498

pip uninstall yfinance
pip install git+https://github.com/ranaroussi/yfinance.git#egg=yfinance
Graecize answered 9/7, 2021 at 19:12 Comment(2)
you are my hero!Friederike
pip install --upgrade yfinance <-- worked for me.Konyn
A
1

Checked out https://github.com/ranaroussi/yfinance/issues/764 and his suggestion didn't work for me but I got it done with

"pip install --upgrade yfinance"

Atalanta answered 9/7, 2021 at 23:13 Comment(0)
T
0

This worked for me:

pip uninstall yfinance
pip uninstall pandas-datareader
pip install yfinance --upgrade --no-cache-dir
pip install pandas-datareader
Tankoos answered 19/7, 2021 at 18:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.