yfinance 0.2.3 on raspberry pi

I have a silly little script that checks the shares each day and sends me a telegram, but it stopped working. After an hour or so of analysis I determined that the version of yfinance on raspberry pi that I had, 1.74, was returning None on any call. If I upgrade to 2.3 on Windows (update pip,pip install -upgrade pip, then pip install –upgrade yfinance, it all starts working again.

Getting it to work on Raspberry Pi was not so simple. This is a record of what I did.

Show the currently installed packages in the venv

source ./.venv/bin/activate
pip list

Upgrade pip and try to upgrade yfinance

pip install --upgrade pip
pip install --upgrade yfinance

You get an error saying that rust is the wrong version. Doing sudo apt install rustc does not install a version of rust that is high enough. So you turn to rust istelf and use:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 

Then follow the instructions. You need to kill the shell or read the message and source “$HOME/.cargo/env”. Then try to upgrade yfinance again.

pip install --upgrade yfinance

It now fails with:

error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects

So try to get gcc working. I read that installing gcc libffi-dev libssl-dev and python3-dev might help so did that, though I already had gcc and python3-dev installed so just needed this:

sudo apt-get install libffi-dev libssl-dev
pip install --upgrade yfinance

And THAT fixed it 😁so I now have yfinance 0.2.3 and yfinance works.