First I should make it clear that my hass install is working great, with no problems whatsoever. I’m just a little confused about what the purpose of the virtual environment really is and when I should activate it. My startup scripts (both in .bashrc and now in systemd) don’t specifically activate it before starting HASS. The only time I noticed any dependency on activating it was when I upgraded HASS as upgrade failed until I ran it after venv activation.
What am I missing here? Am I supposed to be explicitly activating the venv before starting HASS? What is the underlying purpose of the virtual environment?
The virtual environment is to create a defined set of python package versions (and python itself), so the the program running is not altered by someone changing a python module for another program.
Python programmers don’t seem to take backwards compatibility very seriously, so programs can break quite easily just by upgrading a dependent package.
I understand that there is some python magic that automatically invokes the virtual environment when a python program in its path is started.
The upgrade command upgrades the environment it is running in. If you haven’t set a virtual environment before you do it, it attempts to upgrade the default system environment.