Problems upgrading Python 3.9

Hi Everyone,

Hoping someone can help me. Today I bit the bullet to upgrade to Python3.9 from 3.8.6. I’m running my home assistant on raspbian buster on a Pi4 and it does not have supervisor mode.

I followed the instructions here, https://community.home-assistant.io/t/update-python-to-the-new-version-3-9/233523/22

No issues with the above, but when it came to start home assistant it wouldn’t start and I got the following error: -

ERROR (MainThread) [homeassistant.auth.providers] Unable to load auth provider homeassistant: libffi.so.7: cannot open shared object file: No such file or directory

So I found what I thought was the fix to this here: -
https://community.home-assistant.io/t/python-install-on-raspberry-pi-os/241558/11

But I am still getting similar errors, N.B. I now have libffi.so.7 located in /usr/local/lib: -

ERROR (MainThread) [homeassistant.auth.providers] Unable to load auth provider homeassistant: /usr/local/lib/libffi.so.7: undefined symbol: ffi_prep_closure_loc

Can anyone offer any help please?

I just ran this through again, just in case anything was missed and I got the same failure: -

ERROR (MainThread) [homeassistant.auth.providers] Unable to load auth provider homeassistant: /usr/local/lib/libffi.so.7: undefined symbol: ffi_prep_closure_loc
ERROR (MainThread) [homeassistant.bootstrap] Home Assistant core failed to initialize. Further initialization aborted

So on Raspbian Buster, I can’t upgrade python to 3.9 to stay current on HA after December.

Has no one else had any similar issues?

Finally I’ve manged to resolve the issue after a bit of digging around on the internet, apparently people have had issues with libffi in 64bit environments, I’m running my pi in 64bit mode with aarch64 and arm_64bit=1 in /boot/config.txt.

So for people having similar issues: -
I switched back to armv7l by commenting out arm_64bit=1 in /boot/config.txt and rebooting.
I then re-compiled libffi and retried the python3.9 venv, it worked. So I re-added arm_64bit=1 to /boot/config.txt and rebooted again, and it is still working fine, so looks like compiling libffi in 32bit mode is the answer.