Update Python to the new version 3.9

that is the advantage of running VM I can update a whole new machine without messing with my production machine until I am confident that it will work as intended

still the same error

[email protected]:/srv/homeassistant $ python3.9 -m venv .
Error: Command ‘[’/srv/homeassistant/bin/python3.9’, ‘-Im’, ‘ensurepip’, ‘–upgrade’, ‘–default-pip’]’ returned non-zero exit status 1.
[email protected]:/srv/homeassistant $

ok after mucking around in this whole thing it is apparently not a good idea changing the default of the python to the newer version when installing python3.8/3.9 Home assistant straight up does not like that it will not build the bin folder because it locks itself out of that the home assistant folder

but, why not?

Why would it?

Seriously, Docker is just another piece of software. It’s a way of running other software, but it’s just a piece of software. Why would using it for one thing then force you to run everything else with it?

built a copy and paste tutorial to install Python 3.9 that allows Home Assistant to install
This is intended for a Bare metal reinstall of your OS

Home Assistant Friendly Python 3.9

and if you used this tutorial to build your Home Assistant then it is real easy to copy all the Home Assistant files to another location and re paste them once you redo your Home Assistant with 3.9
nice and clean
Installing Home Assistant with File Sharing

It’s a container.
Once you go through the trouble of installing, configuring, monitoring and tuning a stack, it’s painless to adding additional containers.

:man_shrugging:

1 Like

I am using HA with Python 3.9 and one a week I have problem like this:

> Nov 19 14:16:07 server hass[8363]: OSError: [Errno 24] Too many open files
Nov 19 14:16:07 server hass[8363]: 2020-11-19 14:16:01 ERROR (MainThread) [homeassistant] Error doing job: socket.accept() out of system resource
Nov 19 14:16:07 server hass[8363]: Traceback (most recent call last):
Nov 19 14:16:07 server hass[8363]:   File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 164, in _accept_connection
Nov 19 14:16:07 server hass[8363]:   File "/usr/local/lib/python3.9/socket.py", line 293, in accept
Nov 19 14:16:07 server hass[8363]:     fd, addr = self._accept()
Nov 19 14:16:07 server hass[8363]: OSError: [Errno 24] Too many open files
Nov 19 14:16:07 server hass[8363]: 2020-11-19 14:16:01 ERROR (MainThread) [homeassistant] Error doing job: socket.accept() out of system resource
Nov 19 14:16:07 server hass[8363]: Traceback (most recent call last):
Nov 19 14:16:07 server hass[8363]:   File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 164, in _accept_connection

Is it cased by Python 3.9?

Good and simple procedure. Still having problem with mobile_app (Integration)
after upgrade . Do you know something about it ?

I use this guide for install in python 3.8.5 and work fine, and realy easy

Mi HA only stop for 1 minute

2 Likes

Thank you @igorlemos, just used this guide to update to python 3.9.0 on Raspberry Pi OS, as Python 3.7.3 was too old for homeassistant to run on, it seems to be working.

I’ve heard that using ./configure --enable-optimizations instead of ./configure results in Python running a little faster at the expense of a longer build time, but I’m not really sure if the difference will be noticeable on something like homeassistant

Thanks!!! With your steps i made the upgrade without any problem!

When I install python 3.9 i have some problems , my raspberry version Buster have not libffi.7

And I received this error:

libffi.so.7:
      cannot open shared object file:
        No such file or directory

And other error with numpy like this:


IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.9 from "/srv/homeassistant_venv_3.9.9/bin/python3.9"
  * The NumPy version is: "1.21.2"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.29' not found (required by /srv/homeassistant_venv_3.9.9/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-arm-linux-gnueabihf.so)

For solved it i use this post:

I think the definitive solution is install raspbian bullseye 11 in my RaspPi.

¿Someone has done it and it works for them?

now HA need python 3.9 in 2022.1 version

Not all of us want to be forced to switch to docker

Nobody is forcing you to switch to Docker

My response was to the person who thought that most HA users ran PiOS - the statistics make it very clear that they don’t, and that most people run in Docker (94.9% currently).

The devs aren’t going to hold things back for the 5.1%.

You might want to have another look at that page. Under installation types, container is quite clearly only 18%

The Container, Home Assistant OS, and Supervised install types are all predicated upon running Home Assistant Core in Docker containers, so adding up those three types, you’re going to get to the total Tinkerer posted.

I’m running core in a venv and I’ve accepted this installation type is far from the most popular, so I’m largely on my own when it comes to maintenance, and ultimately it would probably be in my own best interest to move to a different install method.

The numpy error above I encountered too but had fixed it by telling it to recompile numpy with a difference architecture (fix posted in another thread), was annoying as it took like 15 minutes. If the post above works then use that instead.

I moved to Bullseye now so it just works and no stuffing around needed.