I tried to follow your instructions for updating Python. I’m trying to update Python 3.10 because 3.9 is not supported with HA 2023.2.
Until now I was not able to upgrade Python.
My questions:
Step E: Which directory do you mean in the second line? /srv/homeassistant of /home/homeassistant ?
Step F: After executing the last line I got the following error: “ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: ‘/srv/homeassistant/lib/python3.10/site-packages/voluptuous’ Check the permissions.”
I have updated the guide now for Python 3.10.9, and tried to be a bit more descriptive of the directories, processes etc.
To answer your questions, the directory is /srv/homeassistant
For step F, I’ve added more descriptions, but if you get a permission error, just follow the instructions given in the “NOTE” section in step E, or you could try running the install command with “sudo” first and then re-running it again with the normal “pip3 install -r requirements.txt” command.
Great post ! Thank you !
No chance with “sudo python3.10 -m venv .” at step E
because I don’t know the homeassisant password but “python3.10 -m venv .” did the job. Then same thing with “sudo -u homeassistant -H -s” just after. I omit it.
Now my HASS is running with Pyhton 3.10.9 and next HA upgrade won’t be an issue.
Thanks for the instruction. Manage to upgrage Python but get an error at the following instruction in section E
Error log
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [55 lines of output]
/srv/homeassistant/lib/python3.10/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
/srv/homeassistant/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
/srv/homeassistant/lib/python3.10/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cffi
ERROR: Failed to build one or more wheels
I would like to suggest to stop EVERY possible service (HA, as well) before running “make”, if you are an old Rpi (like mine 3B+) or it will take a very looooooong time!
This unfortunately is the most complex part of the upgrade. Each persons HomeAssistant Integrations are different, so the requirements are different.
What is happening here is the PIP installer is trying to install all the requirements / prerequisites which are unique to your environment & dependant on integrations / components you have configured in HASS.
You might need to try and resolve those individually, or worst case, you might need to edit your requirements.txt file, and remove the items which PIP has a problem with installing.
One item that might be easily resolvable for instance is the “license_file parameter is deprecated, use license_files instead” where you might just need to update the requirements.txt file to use “license_files” instead of “license_file”.
Hi, I’m running HA with a Python VEnv too and have done multiple Python-Updates ( 3.9, 3.10, 3.11) since I started with HA.
My recommendation is NOT to use the “requirements.txt”-approach.
After downloading and installing Python, creating a new VEnv for the new version like you do describe in the guide I always handled it like a new install of HA and installed HA with pip as described in documentation, then changed the service to point to the new folder and started HA. On startup ( which takes quite a while in this case) it pulls all missing requirements, including those for custom components.
Advantage is that you don’t carry over any dependencies from the old VEnv and the old Python-version
Of course this approach also might produce problems
For cryptography a manual install of rustc was required ( believe this was with Python 3.9), otherwise Python was unable to compile the package
Manually installed python libraries have to be installed again. For example I’m using a Infrared Receiver and the “lirc”-package requires manual installation from source into each new environment
Thanks for a great guide @Pieter_Rossouw ! Below is a quick guide that describe what I did to go from Python 3.11 to 3.12.
Assumptions
HA is run as root. I personally run it in a LXC container (Proxmox). See additional steps provided in the first post in this thread for steps required to use a different user.
The Python runtime previously installed using the deadsnakes PPA.
I just upgraded this and did the same … no requirements.txt. Just backup the old install and reinstall from scratch. Assuming you have the home-assistant service (for stop and start) …
I’ve been able to upgrade from 3.9 to 3.11 with freebsd successfully. I did the requirements things, then I did it again without the requirements steps. The later is indeed superior. Much faster, not installing uneeded deps.
I also have a problem with pyturbojpeg==1.7.1. I can install the updated version, but something requires this version that won’t install. That being said, it works so far. Note that my upgrade is small. I’ve started using ha like 3 days ago.