New version 0.94.0 - How update Python in a Pi3 from 3.5.3 to 3.7.3?

If you’re not confident/comfortable compiling your own Python from the tarball, then that sort of upgrade is probably best avoided until the Raspbian folks update Python in the distro.

But, FWIW, I found a simple sequence of steps that worked once you have later Python compiled and installed:
I created a new venv using the newer Python, copied HomeAssistant config over to it (I chose to keep my config inside the /srv/homeassistant folder, not in ~root/ or elsewhere), and everything is happy. I had feared the worst since not many people mentioned trying HAss under anything later than 3.6.x, but this instance of 94.x seems quite happy there.

Look at my link (6 posts above). I could get it updated in kind of 20 steps that are listed there. Take a look. I could not have done it by myself alone.

Yes I’ve been trying all the things posted here but I’m a Windows/C++/Assembler bod and I don’t speak python or Unix very well. I’ll have another try.

Getting a specific Python version in Linux is often doc’d well in myriad posts. The steps are pretty simple (as long as everything goes as intended). You’ll know if the compile fails - just stop there if not comfortable figuring out what’s missing.
But if you get the newer Py installed, then just follow the HA instructions for a new setup (I use Virtualenv) and your existing config will rule it.

I don’t know python either. The steps are pretty polished right now. Sure, a very basic knowledge of what you are doing is recommended. I advice you to do a backup first.

These instructions as provided by @anon34565116 have been confirmed to work by myself and others. They are specific to a Hass installation in a venv and were carried out on a Raspbian Stretch Lite OS on a Raspberry Pi 3.

They will download Python 3.7.3 source, build, compile install and replace your current venv w

  1. sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev

  2. wget -O /tmp/Python-3.7.3.tar.xz https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz

  3. cd /tmp

  4. tar xf Python-3.7.3.tar.xz

  5. cd Python-3.7.3

  6. ./configure

  7. sudo make altinstall

  8. sudo apt -y autoremove

  9. cd

  10. rm -r /tmp/Python-3.7.3

  11. rm /tmp/Python-3.7.3.tar.xz

  12. sudo systemctl stop [email protected]

  13. sudo mv /srv/homeassistant /srv/homeassistant_old

  14. sudo mkdir /srv/homeassistant

  15. sudo chown homeassistant:homeassistant -R /srv/homeassistant

  16. cd /srv/homeassistant

  17. /usr/local/bin/python3.7 -m venv .

  18. source bin/activate

  19. pip install wheel homeassistant

20a. ** Note I chose to run hass first time to see all the installation messages.**

20b. sudo systemctl start home-assistant@homeassiith Python 3.7.3

From all the posts on this subject I’ve seen these seem to be the most effective.

Again a big thank you to @anon34565116

7 Likes

I.agree with both phrases.

2 Likes

I am happy to assist.
It helps I am a former Unix administrator and still work some in Linux now.

That is your chance. He is the man. :smiley:

I’ve no doubt this subject will be revisited as we come closer to Python 3.5 deprecation time. At least we now have a definitive set of instructions that will work on a Hass installation in a venv.

1 Like

The crazy thing is, I mainly followed the script the Hassbian folks wrote but the HASS developers do not care enough to share with others who could use it.

And a little lateral thinking unearthed a gem for all to use now :joy:

1 Like

OK. Yes me again.
Fearing breaking my working system I bought a new Pi3 B+ from Amazon to experiment on.
After setting it up, doing all the updates et al I went through ConcordeGE’s steps.
I got further but still failed at first.
Crawling through the messages I found it was missing a uuid include folder and the ffi headers/librarys so google found them as
sudo apt-get install uuid-dev libffi-dev
I redid the ./configure and the make and it claims to have worked.
I’ll put it on the working rig tomorrow.

Basically: Thank you to everybody who made suggestions.

1 Like

And just realise what you’ve learned on the journey too. Believe me it was worth it.

1 Like

I’d move to using docker as it removed a lot of the dependency hassles…

1 Like

Not on a Pi.
You do not want the added load of Docker on such a small CPU.

It’s like 3% and a non issue. If you are concerned over performance even bare metal on a rPI is a issue.

1 Like

I agree. There’s no issue with docker on a Pi3…

Don’t you thinks the issue will simply go away when python is upgraded as part of the raspbian stretch distro? Hoping of course this will not be too far out.

Nice ! A big thanks for your Tuto @ConcordGE :slight_smile:

1 Like