Oh sorry - I confused you with the OP
No problem. I was going to make a separate post but this is something that will run as soon as venv users start upgrading to 0.94.
I would strongly recommend leaving the distributionās Python alone and installing 3.7.3 with pyenv (pyenv-install). That way you donāt mess up anything that depends on the system Python.
https://github.com/pyenv/pyenv-installer
You probably need some prerequisites to build Python:
sudo apt libbz2-dev install libbz2-dev libncursesw5-dev libsqlite3-dev uuid-dev libreadline-dev libssl-dev
Follow the instructions on the pyenv installer page to configure your shell, then build 3.7.3:
pyenv install 3.7.3
pyenv shell 3.7.3
python -m venv [name of venv (such as homeassistant)]
[name of venv]/bin/activate
pip install homeasssitant, etc (follow HA instructions)
I compiled and installed python 3.7.3 on my raspberry.
I also run home assistant in a venv like you. What you can do is[1]:
python3 -m venv --upgrade /srv/homeassistant/
(or whereever your homeassistant directory is).
A short ls
will show:
$ ls /srv/homeassistant/lib/
python3.5 python3.7
I still donāt know how to go from here because home assistant still launches from 3.5. But we will figure it out
I have 2.7 running along side 3.5 and 3.7, as long as you donāt adjust the symlink to /usr/bin/python3
you donāt cause problems.
Or as froz suggested give pyenv
a shot.
Thanks for that.
As Python 3.6 or greater is not currently in the Raspbian Stretch repos and we donāt have a version of Raspbian Buster it means that Python needs to manually downloaded and built.
What Iām trying to put together here is a procedure to manually download and build a version of Python outside of the current repo and then replace my current Python Hass venv with this newly built version.
Why do you say that? I update python, and then replace the link so that it does use the newly installed version. This then means no upgrade of venv is required, it just uses it from there out. No issues through the last 12 months that I know of.
When I symlinked python3 to 3.7 i was getting some errors, could have just been a missing dep, but I reverted the link anyways.
I have a venv setup with HASS in it and itās working fine, also wanted a new venv as the old one had some very very old pyozw hacks still lurking about in it that I didnāt want/need anymore
Great!
For increased instability we now use a problem-prone application on a buggy OS and need to determine which part is causing a particular issue.
People use Hassbian
because, like Hassio HassOS
, it is a complete image for those who have advanced a little beyond the beginner stage & want more flexibility/customization. Yes, the real techies can āroll their ownā but many of us do too much of that for our job and want things that work fairly reliably.
For now I am stepping back & considering my options.
+1 here too.
The last couple of updates have been so time consuming my HA server has had more downtime than uptime trying to resolve the issues.
My current install 0.93.2 appears to be quite stable at the moment so until I can work out a definitive way of progressing beyond it and the Python issue Iām afraid Iāll be like Moses as far as the the great Home Assistant v 1.0 project is concerned. I made the journey but I wonāt get to see it
We need to find Joshua
Or even The Holy Grail that is HA v1.0. Now that will be interesting to witness
I feel like Caleb, the old man along for the ride
I am running Raspbian Stretch Lite with Python 3.5.3, with HA in a venv. As you I am searching a reliable way to update to Python 3.7.3. It seems that it can be done with code from this link. I still havenāt done, maybe this weekend. I want to do a SD backup first, in case something go wrong.
I guess I need a bit more help. I am still running on my original All In One Installer. When I upgrade HA I use the commands
sudo su -s /bin/bash homeassistant
source /srv/homeassistant/homeassistant_venv/bin/activate
pip3 install --upgrade homeassistant
I followed the procedure at my normal login but my HA is still showing python version 3.5.3. I tried to do the procedure within
sudo su -s /bin/bash homeassistant
source /srv/homeassistant/homeassistant_venv/bin/activate
but when I get to sudo make install I get a prompt asking for homeassistant password. I have tried every password I have ever used on the pi and HA and nothing works. Any help would be appreciated. Thanks
Of course it will. All youāre doing is updating Hass and not the Python end it is installed in.
As I mentioned so many looking for guidance on this subject.
I will attempt to pull all the suggestions that were made together and see if I can come up with a simple copy/paste set of instructions to achieve this.
Any Hass venv users please feel free to pitch in on this. This is something all venv users can use going forward.
I can throw out some untested ideas.
- Upgrade python on your OS.
- In your venv run
pip freeze > requirements.txt
This creates a file with the installed python modules. - Stop Home Assistant
- Delete the old venv (need to verify how)
- Create a new venv In /srv/homeassistant, run
$ sudo -u homeassistant -H -s
$ cd /srv/homeassistant
$ python3 -m venv .
$ source bin/activate
- Install the modules
pip install -r requirements.txt
- Start Home Assistant
- ?? Profit ??
Thatās definitely taking shape along the lines I was thinking.
From what I was reading you can have as many different versions of Python on your system as long as they are isolated in separate folders from each other.
So as Iām reading it you need to do the following
-
Download the Python source of your choice into your chosen folder
-
Build the binaries
-
Install those binaries
-
Create the venv
-
Restore your HA config to the new venv
Have I missed anything here.
Well technically your HA config lives outside of the venv in /home/homeassistant/.homeassistant/
, your venv of python lives in another directory ie: /srv/homeassistant/
No need to restore anything as the config doesnāt go anywhere.