Python 3.6 support is deprecated in virtualenv

Having issues with your DietPi installation, or, found a bug? Post it here.
Ziocharly
Posts: 9
Joined: Mon Nov 11, 2019 4:02 pm

Re: Python 3.6 support is deprecated in virtualenv

Post by Ziocharly »

@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...
novitibo
Posts: 68
Joined: Mon Feb 29, 2016 5:11 pm

Re: Python 3.6 support is deprecated in virtualenv

Post by novitibo »

I don't know.. is the best way to wait that stable Dietpi shall ship python ver>3.6.3?
Last edited by novitibo on Thu Nov 14, 2019 5:11 pm, edited 1 time in total.
Ziocharly
Posts: 9
Joined: Mon Nov 11, 2019 4:02 pm

Re: Python 3.6 support is deprecated in virtualenv

Post by Ziocharly »

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...
Ziocharly
Posts: 9
Joined: Mon Nov 11, 2019 4:02 pm

Re: Python 3.6 support is deprecated in virtualenv

Post by Ziocharly »

@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 !
Attachments
Schermata 2019-11-16 alle 01.44.42.png
novitibo
Posts: 68
Joined: Mon Feb 29, 2016 5:11 pm

Re: Python 3.6 support is deprecated in virtualenv

Post by novitibo »

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!
Ziocharly
Posts: 9
Joined: Mon Nov 11, 2019 4:02 pm

Re: Python 3.6 support is deprecated in virtualenv

Post by Ziocharly »

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... ;)
novitibo
Posts: 68
Joined: Mon Feb 29, 2016 5:11 pm

Re: Python 3.6 support is deprecated in virtualenv

Post by novitibo »

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.
Ziocharly
Posts: 9
Joined: Mon Nov 11, 2019 4:02 pm

Re: Python 3.6 support is deprecated in virtualenv

Post by Ziocharly »

Not happened to me,
everything ok with no warning or error...
novitibo
Posts: 68
Joined: Mon Feb 29, 2016 5:11 pm

Re: Python 3.6 support is deprecated in virtualenv

Post by novitibo »

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 8)
User avatar
MichaIng
Site Admin
Posts: 2293
Joined: Sat Nov 18, 2017 6:21 pm

Re: Python 3.6 support is deprecated in virtualenv

Post by MichaIng »

Currently some issues fall together:
- There is a current external bug with Home Assistant that leads to the 404 on web access. We implemented a workaround: https://github.com/MichaIng/DietPi/issu ... -550532477
- I did not yet implement this when posting the above instructions since I was hoping for a quick fix on HA side. Sorry for forgetting about that...
- The warning about /home/homeassistant/.pyenv already existing btw could have been ignored. It just skips the pyenv install which already exists but should go on normally. However as one of below steps, with current dev merge, this dir is indeed removed first now to have an updated/clean pyenv on every reinstall. The longest time takes the Python build anyway which is done in every case. I kept this also to have a clean an in case updated Python instance on every reinstall. After some consideration I guess it is best, and instead we should never force an automated reinstall of HA but patch changes into existing instances or leave the choice to user when to take the time for a 1 hour reinstall ;).

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:
- Before, HA was installed into a virtualenv of the pyenv. However this is doubled abstraction since pyenv is already an independant local Python instance that was installed into the HA home directory, hence unusable for everything else. Creating again a virtual instance from this, has simply not advantage.
- Now HA ist installed with its own pyenv as before, but without the additional virtualenv.
- This allowed to skip related pyenv modules, hence now only the core pyenv is used.
- I then as well rechecked our APT dependency packages, and those obviously were taken from some other, now obsolete, Hass.io build guide, however most of them are not required for our pyenv method.

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.
Post Reply