Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Software | Home Assistant: Skip (re)installing pyenv/Python #2374

Closed
MZorzy opened this issue Dec 28, 2018 · 9 comments
Closed

DietPi-Software | Home Assistant: Skip (re)installing pyenv/Python #2374

MZorzy opened this issue Dec 28, 2018 · 9 comments
Labels
Enhancement 💨 Solution available 🥂 Definite solution has been done
Milestone

Comments

@MZorzy
Copy link

MZorzy commented Dec 28, 2018

not a bis issue but every time
dietpi-software reinstall 157
it ask to reinstrall python 3.6.3 y/N , if No it end and not upgrade. if y ... redownload with lot of time consumping.

may be an option to check if exist 3.6.3 and skip OR continue upgrade/reinstall ?

@MichaIng
Copy link
Owner

@MZorzy
Thanks for your request.

Python is installed within pyenv. Requires investigation in how to check for installed python version within pyenv. In question, to be failsafe, always (re)install Python at least assures functionality.

Why actually do you need to reinstall HA that often, that Python reinstall is an issue?

it ask to reinstrall python 3.6.3 y/N , if No it end and not upgrade.

The related code line is: su --shell /bin/bash --command "cd $ha_userroot; $ha_pyenv_activation; pyenv install $ha_python_version" $ha_user

  • Actually dietpi-software should go on fine (doesn't it?), if you choose no, so if there is no way reliable check for installed python version, maybe we can run the command non-interactively, so default answer (capital N, so no is default?) will be chosen.
  • Or does running pyenv-installer before, somehow clears the environment (partly), so that python needs to be reinstalled to avoid errors? But these should not show up during install step, since nothing is error handled there, script should just do on in case of failure.
  • Will test myself and try to replicate.

Generally the HA installer could retrieve some update. Looks like copy and paste from a guide, with a complexity that is not required for DietPi (but works!).

@MichaIng
Copy link
Owner

Further research:

  • pyenv actually is a Python version manager only. If HA is compatible with the one, installed by default via repo, it should work without pyenv?

Home Assistant provides multiple ways to be installed. A requirement is that you have Python 3.5.3 or later installed.

  • 3.5.3 available on Stretch: https://packages.debian.org/de/stretch/python3, so pyenv should be only required on Jessie.
  • Actually I would drop support on Jessie to simplify the install code, just keep support (and uninstall code) for existing HA setups. But this would break reinstall for those systems as well. Maybe check survey for HA + Jessie systems first.

@MichaIng MichaIng changed the title skip re-install python 3.6.3 (157 home-assistant) DietPi-Software | Home Assistant: Skip (re)installing pyenv/Python Dec 28, 2018
@MZorzy
Copy link
Author

MZorzy commented Jan 16, 2019

@MZorzy
Thanks for your request.

The related code line is: su --shell /bin/bash --command "cd $ha_userroot; $ha_pyenv_activation; pyenv install $ha_python_version" $ha_user

testing commented out # that line,
running dietpi-software reinstall 157 upgrade HA to last version as i want, without reinstall pyton. fast and work. (maybe skip also ffmpeg)
homeassisant add new device, and release new version, very very often

@MichaIng
Copy link
Owner

MichaIng commented Jan 16, 2019

There is no internal updater (from web UI) available, right?

Yeah so maybe we can check for existing install and skip dependency install then. Only thing is, if dependency min version raises, the update breaks HA. So at best check and compare installed and required dependency versions.

Or we skip the whole pyenv, if possible.

@MZorzy
Copy link
Author

MZorzy commented Jan 16, 2019

there is no an internal updater if installed as "157",
but there is with docker-hassio (https://github.com/home-assistant/hassio-build/tree/master/install) with add-on feature
don't know how/if docker slowdown raspberry.

@MichaIng
Copy link
Owner

MichaIng commented Jan 16, 2019

@MZorzy
At least docker is another layer of abstraction that we want to avoid within DietPi.
The updater is as well not "internal" there, but via updating it's docker container.

So okay, then a full reinstall is required as update and dietpi-software reinstall 157 should cover that without doing repeating the log taking python updates every time.

And thanks for giving us the hint about the doubled topic. I will move the info here and close the other one.


Ref: https://dietpi.com/phpbb/viewtopic.php?t=5369

Currently we run the install script within a virtual environment (virtualenv/pyenv), which runs in a subshell of again a sudo subshell, so three (or more) orders of abstraction... There everything, especially Python is built from source, which takes a veeery long time. Users report more than 40 minutes (on SBC), only for the Python build, afterwards pip installs again take time.

Of course it is always safe to run stuff in a sandbox, but if we know what we do, it should be not required.

  • Check current HA install instructions
  • Try to reduce the abstraction layers, at least su ... eval ... is not required. At best install outside of pyenv, make it use Python (+pip) from APT packages instead.

@MZorzy
Copy link
Author

MZorzy commented Jan 29, 2019

Why actually do you need to reinstall HA that often, that Python reinstall is an issue?
cause "update and fix" some time too fast...
Release 0.86.1 - January 23
Release 0.86.2 - January 24
Release 0.86.3 - January 26
Release 0.86.4 - January 28

meanwhilr i edit dietpi-software skipping "# Install Python which is needed for HA" on line 6891-6892

@MichaIng
Copy link
Owner

MichaIng commented Nov 6, 2019

PR up to inform users about long install process (+ Python update and slight install enhencements): #3220
The info contains a link to this issue, however steps to reduce the (re)install times are still outstanding.

@MichaIng MichaIng added this to the Planned for implementation milestone Nov 6, 2019
@MichaIng MichaIng modified the milestones: Planned for implementation, v6.27 Jan 1, 2020
@MichaIng MichaIng added Solution available 🥂 Definite solution has been done and removed Investigating 🤔 labels Jan 1, 2020
@MichaIng
Copy link
Owner

MichaIng commented Jan 1, 2020

With v6.27, install has been simplified, but the pyenv install + Python compiling stays. We cannot really skip it due to the vast amount of special module version needs. Only alternative would by venv from APT-installed Python. With this, Python does not need to be compiled anymore, but the instance it less independent and lower version.

I mark this issue as closed for now. Further discussion/enhancements can be done at a later date.

@MichaIng MichaIng closed this as completed Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement 💨 Solution available 🥂 Definite solution has been done
Projects
None yet
Development

No branches or pull requests

2 participants