After struggling with this for a few days what worked for me was to install exactly Python 3.7.9 (not the latest python 3.7)
I used the macos installer from here https://www.python.org/downloads/release/python-379/ and created an alias
alias python=/usr/local/bin/python3