Python upgrade

Like I said. You have to think the docker way, and stop trying to force the old methods on it.

Whipped up a bash script if anyone wants to give it a whirl

It installs to /usr/local/opt so it won’t bother an official python3.7 install once one’s available.
I’ve tried to incorporate suggestions to have it reinstall the python modules for you as well.

1 Like

Totally disagree: users should have a choice. If I wanted easy, I would use Hassio. I wanted “familiar” and “reliable”, and therefore chose a plain vanilla Raspbian install with venv.

“Old” does not necessarily mean “bad” or “obsolete”. It can also mean “mature”, “well tested”, and “trustworthy”. The .deb way of installing things has been proven for ~ 25 years and is used by millions of professional servers.

The venv way is on the web site as a way to install HA, and it worked fine for over a year.

Once Buster is released, this issue goes away, and no need to fight with Docker to get what I had working before and broke down, to work again.

3 Likes

I ran into the same problem and have fixed by upgrading the home assistant and hassbian-scripts as follow:

  • sudo hassbian-config upgrade hassbian => to upgrade Home Assistant first
  • sudo hassbian-config upgrade hassbian-script => to upgrade hassbian-scripts

Regards
Kadfils

Thank you very much for your help, but it still does not work. (?)
I have managed to install Python 3.7.3 successfully, but in the Home Assistant version 3.5.2 still appears. Do you know why? There must be a way to correct this. My problem is that I am a beginner and there are many things that I do not know. I do not know what to do. I have made several attempts following the advice of people in the forum, but I can not solve the problem.

Regards

In a separate post from @bosbourne he listed a successful method of upgrading Python to 3.7.3 with Hass in situ. It has worked for a number of users.

  1. sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev

  2. wget -O /tmp/Python-3.7.3.tar.xz https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz

  3. cd /tmp

  4. tar xf Python-3.7.3.tar.xz

  5. cd Python-3.7.3

  6. ./configure

  7. sudo make altinstall

  8. sudo apt -y autoremove

  9. cd

  10. rm -r /tmp/Python-3.7.3

  11. rm /tmp/Python-3.7.3.tar.xz

  12. sudo systemctl stop [email protected]

  13. sudo mv /srv/homeassistant /srv/homeassistant_old

  14. sudo mkdir /srv/homeassistant

  15. sudo chown homeassistant:homeassistant -R /srv/homeassistant

  16. cd /srv/homeassistant

  17. /usr/local/bin/python3.7 -m venv .

  18. source bin/activate

  19. pip install wheel homeassistant

20a. ** Note I chose to run hass first time to see all the installation messages.**

20b. sudo systemctl start [email protected]

6 Likes

works well for me, thank you very much !

Thank you very much. After the upgrading Python to 3.7.3 my Home Assistant won’t start!

"$ sudo systemctl status [email protected]
? [email protected] - Home Assistant for homeassistant
Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-06-13 00:08:52 CEST; 10min ago
Process: 540 ExecStart=/srv/homeassistant/bin/hass (code=exited, status=1/FAILURE)
Main PID: 540 (code=exited, status=1/FAILURE)

jun 13 00:08:51 hassbian systemd[1]: Started Home Assistant for homeassistant.
jun 13 00:08:52 hassbian hass[540]: Traceback (most recent call last):
jun 13 00:08:52 hassbian hass[540]: File “/srv/homeassistant/bin/hass”, line 6, in
jun 13 00:08:52 hassbian hass[540]: from homeassistant.main import main
jun 13 00:08:52 hassbian hass[540]: ModuleNotFoundError: No module named ‘homeassistant’
jun 13 00:08:52 hassbian systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
jun 13 00:08:52 hassbian systemd[1]: [email protected]: Unit entered failed state.
jun 13 00:08:52 hassbian systemd[1]: [email protected]: Failed with result ‘exit-code’."

Do you know what is happening?. What to do to correct the error?

Are you starting HS from a service daemon. If so where is the path pointing to. Once you have rebooted your Pi type

sudo systemctl status [email protected]

Paste the output here.

You know, I did a new installation of Python 3.7.3 following the 20 steps you sendt to me. After the 19. step when its finished, I got this error:

Could not install packages due to an EnvironmentError: [Errno 13] Adgang nægtet:
‘/srv/homeassistant/lib/python3.7/site-packages/wheel’
Consider using the --user option or check the permissions.

What to do? It is work if I use --user? (pip install wheel --user).

Yes pip is telling you what to do here.

After the install (pip install wheel --user) I started the home assistant service ( $ sudo systemctl start [email protected]). The Home Assistant it’s NOT starting! You can se it in the log:

pi@hassbian:~ $ tail -30 /var/log/syslog
Jun 13 13:00:01 hassbian CRON[22947]: (pi) CMD (~/duckdns/duck.sh >/dev/null 2>&1)
Jun 13 13:00:01 hassbian CRON[22948]: (pi) CMD (/home/pi/certbot/certbot-auto renew --quiet )
Jun 13 13:01:56 hassbian CRON[22938]: (CRON) info (No MTA installed, discarding output)
Jun 13 13:05:01 hassbian CRON[23280]: (pi) CMD (~/duckdns/duck.sh >/dev/null 2>&1)
Jun 13 13:10:01 hassbian CRON[23338]: (pi) CMD (~/duckdns/duck.sh >/dev/null 2>&1)
Jun 13 13:15:01 hassbian CRON[23400]: (pi) CMD (~/duckdns/duck.sh >/dev/null 2>&1)
Jun 13 13:17:01 hassbian CRON[23439]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jun 13 13:20:01 hassbian CRON[23508]: (pi) CMD (~/duckdns/duck.sh >/dev/null 2>&1)
Jun 13 13:25:01 hassbian CRON[23602]: (pi) CMD (~/duckdns/duck.sh >/dev/null 2>&1)
Jun 13 13:28:11 hassbian systemd[1]: Started Home Assistant for homeassistant.
Jun 13 13:28:11 hassbian systemd[23673]: [email protected]: Failed at step EXEC spawning /srv/h omeassistant/bin/hass: No such file or directory
Jun 13 13:28:11 hassbian systemd[1]: [email protected]: Main process exited, code=exited, statu s=203/EXEC
Jun 13 13:28:11 hassbian systemd[1]: [email protected]: Unit entered failed state.
Jun 13 13:28:11 hassbian systemd[1]: [email protected]: Failed with result ‘exit-code’.
Jun 13 13:30:01 hassbian CRON[23732]: (pi) CMD (~/duckdns/duck.sh >/dev/null 2>&1)
Jun 13 13:35:01 hassbian CRON[24006]: (pi) CMD (~/duckdns/duck.sh >/dev/null 2>&1)
Jun 13 13:40:01 hassbian CRON[24124]: (pi) CMD (~/duckdns/duck.sh >/dev/null 2>&1)
Jun 13 13:41:14 hassbian smbd[24216]: [2019/06/13 13:41:14.478663, 0] …/source3/smbd/ipc.c:843(reply_trans)
Jun 13 13:41:14 hassbian smbd[24216]: reply_trans: invalid trans parameters
Jun 13 13:45:01 hassbian CRON[24360]: (pi) CMD (~/duckdns/duck.sh >/dev/null 2>&1)
Jun 13 13:46:06 hassbian systemd[1]: Started Home Assistant for homeassistant.
Jun 13 13:46:06 hassbian systemd[24396]: [email protected]: Failed at step EXEC spawning /srv/h omeassistant/bin/hass: No such file or directory
Jun 13 13:46:06 hassbian systemd[1]: [email protected]: Main process exited, code=exited, statu s=203/EXEC
Jun 13 13:46:06 hassbian systemd[1]: [email protected]: Unit entered failed state.
Jun 13 13:46:06 hassbian systemd[1]: [email protected]: Failed with result ‘exit-code’.
Jun 13 13:50:01 hassbian CRON[24459]: (pi) CMD (~/duckdns/duck.sh >/dev/null 2>&1)
Jun 13 13:50:43 hassbian smbd[24468]: [2019/06/13 13:50:43.014959, 0] …/source3/smbd/ipc.c:843(reply_trans)
Jun 13 13:50:43 hassbian smbd[24468]: reply_trans: invalid trans parameters
Jun 13 13:53:01 hassbian smbd[24504]: [2019/06/13 13:53:01.990606, 0] …/source3/smbd/ipc.c:843(reply_trans)
Jun 13 13:53:01 hassbian smbd[24504]: reply_trans: invalid trans parameters

An other thing. Whe finished wheel install, this text appears:

The script wheel is installed in ‘/home/homeassistant/.local/bin’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed wheel-0.33.4

Does it mean something important?

The log file its saying that “srv/homeassistant/bin/hass” NOT EXIST!:

Jun 13 13:28:11 hassbian systemd[23673]: [email protected]: Failed at step EXEC spawning /srv/h omeassistant/bin/hass: No such file or directory

I asked you in an earlier post to paste the contents of your service daemon. You should find it in /etc/systemd/system folder.

You need to locate your instance of Homeassistant and launch it manually.

Assuming you originally installed HA using these instructions https://www.home-assistant.io/docs/installation/raspberry-pi/

you should be able to launch HA manually.

Just to be clear. You did manually install HA on the Raspberry Pi and not install from a Hassbian image

Thank you very much for your help. You know, at the end I made a new installation of Hassbian (hassbian image) and after some hours of installation and configuration’s work, the Home Assistant works and has Python 3.7.3 installed on it! (Alleluya!). In truth, there is something that stopped working: the icons that I installed from “materialdesignicons.com”. Is there something I’m missing to update?

Have you checked your logs.

I found an error in configuration.yaml. “homeassistant” appeared in 2 places. Now everything works perfectly. Thank you again!

You’re welcome. Your logs are your best friend in HA.

Is anyone else having a problem with gstreamer after upgrading python? I did a pip3 install gi to get past the first issue of it not finding the gi module, but now I get:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/gstreamer/media_player.py", line 31, in setup_platform
    from gsp import GstreamerPlayer
  File "/srv/homeassistant/lib/python3.7/site-packages/gsp/__init__.py", line 11, in <module>
    import gi  # pylint: disable=import-error
  File "/srv/homeassistant/lib/python3.7/site-packages/gi/__init__.py", line 39
    print url
            ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(url)?```