Python 3.6 support is deprecated and will be removed in the first release after December 15, 2019. Please upgrade Python to 3.7.0 or higher.
What is the best way to update python for Home assistant in Dietpi virtualenv?
Python 3.6 support is deprecated and will be removed in the first release after December 15, 2019. Please upgrade Python to 3.7.0 or higher.
What is the best way to update python for Home assistant in Dietpi virtualenv?
+1
Just the same question: right way to update python venv, used for HA, to the V.3.8 ?
Anyone have idea ???
I currently implemented it with 3.7.5, since 3.8 was still in beta? But we could test it, from within the dev branch:
G_CONFIG_INJECT 'DEV_GITBRANCH=' 'DEV_GITBRANCH=dev' /DietPi/dietpi.txt
dietpi-update 1
sed -i 's/3\.7\.5/3.8.0/' /DietPi/dietpi/dietpi-software
dietpi-software install 157 # or "reinstall"
@MichaIng, ok, I’ll try !
Only one confirmation :
inside HA now I see venv 3.6.3, not 3.7.5,
I’ve to edit your sample command ?
or I can run anyway this syntax, before install 157…
Thanks for support !!!
Current stable DietPi ships v3.6.3 indeed, dev branch (the first commands apply it, which should be hence done first) ships v3.7.5, so there the sed replacement will work.
Umhhh, something wrong :
pyenv-virtualenv: 3.8.0' is not installed in pyenv. pyenv: version
homeassistant-3.8.0’ not installed
homeassistant-3.6.3
pyenv-virtualenv: version `homeassistant-3.8.0’ is not a virtualenv
and HA remain on python 3.6.3…
Sorry,
for venv update I miss this part:
so, what is the procedure for python update under virtualenv?
There is a difference between venv (guide) and pyenv what we use. To update Python within the pyenv, reinstall Home Assistant as of my post above. This assures that everything is done with right user and all related versions fit together.
So it seems that Python 3.8.0 is not yet supported by pyenv, however I will do some test later as well. However with current dev branch Python 3.7.5 is installed which should work very well and in theory more stable than a first new minor version update.
I tried:
Now on ha-ip:8123:
404: Not Found
@novitibo, same result for me…
My sequence:
Exe > sudo systemctl stop home-assistant
On /home/homeassistant delete folder ‘pyenv’
Exe > G_CONFIG_INJECT ‘DEV_GITBRANCH=’ ‘DEV_GITBRANCH=dev’ /DietPi/dietpi.txt
Exe > dietpi-update 1
Exe > dietpi-software reinstall 157
Result: HA service run but GUI have 404 error…
I don’t know… is the best way to wait that stable Dietpi shall ship python ver>3.6.3?
I’agree,
anyway I still try a little and inform you if I have a good result…
The solution is based on this:
pip3 install home-assistant-frontend==20191025.1
as suggested by MichaIng…
novitibo
finally this fix frontend error 404, this used cmd sequence :
1> sudo systemctl stop home-assistant
2> sudo -u homeassistant -H -s
3> source /home/homeassistant/.pyenv/versions/3.7.5/envs/homeassistant-3.7.5/bin/activate
4> pip3 install home-assistant-frontend==20191025.1
5 (optional) > pip install --upgrade pip
6> sudo systemctl start home-assistant
Many thanks to Sandro, of SDomotica, and MichaIng for suggestion and support !
great!
how did you get .pyenv version 3.7.5?
I don’t have folder: /home/homeassistant/.pyenv/versions/3.7.5/envs/homeassistant-3.7.5/bin/, but still original 3.6.3
please give me also cmd sequences for python upgrade to ver.3.7.5
tnx!
Also for me has been a problem to find where is available Python, after 157 reinstall.
I discovered it this way :
find / -name activate
This find all ‘activate’ cmd for Python instance on your RB,
choose the path discovered relative to your 3.7.5 venv,
installed by the process explained by MichalIng :
G_CONFIG_INJECT ‘DEV_GITBRANCH=’ ‘DEV_GITBRANCH=dev’ /DietPi/dietpi.txt
dietpi-update 1
dietpi-software reinstall 157
Hope you update without problems…
ok,
success!
only one issue so far:
Invalid config
The following components and platforms could not be set up:
cloud
Please check your config.
Do you get that info also?
As I understant is something about cryptography of Dietpi update from stretch to buster.
Not happened to me,
everything ok with no warning or error…
Since I have too much problems, I decided to wait a little bit for https://github.com/MichaIng/DietPi/pull/3226 stable release.
Seems it is not safe to force dietpi Buster upgrade due to untested components, home assistant will wait another month .
Thank you
Currently some issues fall together:
I added Python 3.8.0 now. It works, however after installing, when having the service started the first time, it still “can” result in 404 on first web access. In such case one should wait until it installed all dependencies, i.e. check htop and wait until CPU usage of the HA service goes down to zero. Then the service needs to be restarted once: systemctl restart home-assistant
I am not sure why, but in some cases on first web UI access, the internal Python module installer fails to find certain modules. When using Python 3.7.5 this was only rarely the case (no pattern that I could find), and if so, the web UI still opens, but you’ll see some warnings on notification page.
With Python 3.8.0 mostly it results in 404 first. Checking journalctl -u home-assistant then reveals that the error is basically the same, it just fails on different Python modules, especially one that is required for the webserver (web UI). However in all cases a simple service restart fixed this, all Python dependency modules are then found and installed successfully.
I then could not hold myself, after testing up and down, to simplify the install:
Latest merge into dev branch with all above updates and workaround for the external bug: https://github.com/MichaIng/DietPi/pull/3231
Due to the long taking install and bid complicated pyenv activation from console, I added some feature that allows to add additional APT and Python module dependencies to be installed with HA automatically. There are some integrations which require additional external libraries and/or Python modules, which are not automatically pulled by HA, e.g. when replacing the default SQLite database with MariaDB. The latter requires an additional package to be installed PRIOR to Python build and an additional Python module which is not pulled by the HA service automatically.