Error on execute HA with python3.7

hi, i have installed HA on a LXC debian 9 system, this run very well but a few weeks ago I was warned to upgrade the version of Python at least to 3.6, no problem!
Download and compile the sources of the 3.7, install it and set up the system so that it runs all the python scripts with the latest version, control and everything works well:

usr@HOMEAUTOMATION:/var/lib/home-assistant# python -V
Python 3.7.3
usr@HOMEAUTOMATION:/var/lib/home-assistant# update-alternatives --config python
There are 3 choices for the alternative python (providing /usr/bin/python).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/python3.7   3         auto mode
  1            /usr/bin/python2.7   1         manual mode
  2            /usr/bin/python3.5   2         manual mode
* 3            /usr/bin/python3.7   3         manual mode

Press <enter> to keep the current choice[*], or type selection number:

but, BUT, B U T
HA start every time with python 3.5, i look at the start-up systemd configuration:

usr@HOMEAUTOMATION:/var/lib/home-assistant# cat /etc/systemd/system/home-assistant.service 
[Unit]
Description=Home Assistant
After=network.target

[Service]
User=hass
Group=hass
Type=simple
ExecStart=/usr/bin/hass --config /var/lib/home-assistant

[Install]
WantedBy=multi-user.target

and at the script:

usr@HOMEAUTOMATION:/var/lib/home-assistant# cat /usr/bin/hass 
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys

from homeassistant.__main__ import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

how i can fix this? I tried to change the interpreter to python3.7 but this not work.
debian -> 9.9
HA -> 0.94.4
python -> 3.7

Although you do not say, it is implied you are running a manual installation in a python venv. you are not checking when you are in that venv. You need to rebuild the venv and then reinstall home assistant in that new venv.
Building python yourself it would have been better to do an altinstall to not impact system installed packages.

EDIT: You did not follow ANY of the installation documents so you are on your own
If you has installed in a venv according to the instructions hass would be at /srv/homeassistant/bin/hass not in /usr/bin with the OS files.

1 Like