Home assistant not starting after upgrading to python 3.7

For a while home assistant was bugging me with messages that I should upgrade python, because python 3.5 would no longer be supported.

I have home assistant running on a nuc on Debian. I found this guide to upgrade python: https://exitcode0.net/debian-9-how-to-upgrade-python-3-5-to-python-3-7/

I executed these steps:

After those steps I restarted home assistant, but I noticed it was still telling me I was using python 3.5. I also noticed that when I executed python --version, I got version 3.7, but when I executed ython3 --version, I got version 3.5

I figured that I maybe had to point python 3 to the new version too, so I executed:
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.7 10

Not sure if that was a good thing to do, because after it, home assistant wouldn’t start anymore at all. In the log I get these errors:

Dec 01 15:45:09 nuc systemd[1]: Started Home Assistant.
Dec 01 15:45:09 nuc hass[1679]: Traceback (most recent call last):
Dec 01 15:45:09 nuc hass[1679]:   File "/home/nuc/homeassistant/bin/hass", line 6, in <module>
Dec 01 15:45:09 nuc hass[1679]:     from homeassistant.__main__ import main
Dec 01 15:45:09 nuc hass[1679]: ModuleNotFoundError: No module named 'homeassistant'
Dec 01 15:45:09 nuc systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Dec 01 15:45:09 nuc systemd[1]: [email protected]: Unit entered failed state.
Dec 01 15:45:09 nuc systemd[1]: [email protected]: Failed with result 'exit-code'.

I thought that maybe I was on a too old version of home assistant, so I tried to upgrade it by executing:

cd homeassistant
source bin/activate
python3 -m pip install --upgrade homeassistant

But that gave me the error “No module named pip”
According to this page: https://www.home-assistant.io/docs/installation/troubleshooting/ it should be fixed by executing the get-pip.py script, but that just gave me the next error:

subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

So now I’m kind of stuck. Any idea how to get home assistant working again?

You needed to rebuild your venv - effectively a fresh install.