Fixing CERTIFICATE_VERIFY_FAILED when using yfinance's

I've been using the excellent yfinance project ( to get stock prices. However today when trying to read a ticker's basic information, it failed on me with:

File ".../venv/lib/python3.7/site-packages/pandas/io/", line 848, in _parser_dispatch
raise ImportError("lxml not found, please install it")

So I pip install lxml and try again. This time I get this exception:

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/", line 1319, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>

It turns out it's because I am running Python on Mac OS and I need to install some certificates (

So I opened Finder and navigated to Applications, Python 3.7, then ran Install Certificates.command. And it worked indeed!