I’m running Home Assistant Core in my main environment (no venv). Today I tried to update to 2023.7.
There is something weird going on in my installation as it fails finding rust.
However I do have rust installed
So it seems to take the right python and pip version…
I really cannot understand which version of pip and python is using and why. Also, why wouldn’t it find rustc if it is installed in the system for the pi user? In the past I was able to solve this by installing rust with apt but that version is too outdated now.
Not sure about your pip-Version, I’m using Core with a venv, works for me, once in a while it asks me to update pip.
For rust, my notes say that I deinstalled rust and cargo quite a while back with apt and installed it using curl https://sh.rustup.rs 2 -sSf | sh
Can you show the error you get about rustc?
If I recall correctly, I had rust installed with my “homeassistant”-user ( the user configured for systemd to run the HA service ), not with the “pi”-user. Some dependencies are installed by this service after it is started and this services likely does not have access to the “.cargo” folder in your “pi”-user’s home directory.
yeah, that’s because you installed home assistant with the homeassistant user, but in my case I installed everything under pi in order to avoid exactly these kind of issues.
In my case there is only the pi user and all packages (python, home assistant, rustc,…) are installed under this user.
That’s why I cannot wrap my head around this error
sorry when it sounds like asking stupid questions…
In your installation the homeassistant service is configured in the systemd configuration to run as “pi”-user? Or you start the “hass”-script manually?
It seems so, but I haven’t tried properly because I was getting all sorts of different errors so, in order not to waste my day, I decided to rollback to 2023.6.3 and for now everything has been working ok.
The problem seem to come from the fact that the environment where hass is running is not the same one that I have when running a normal interactive session.
Right, I missed that. You shouldn’t be installing things in your system Python. This is why things are getting messed up regarding what’s being used. Just save yourself a lot of trouble and switch to a venv and leave the system Python one. It’s pretty easy to do.
To check which executable is being used, run e.g. which python or which pip.
Well, as I’m using python 3.10 ONLY for Home Assistant, there is really no reason to create another venv. Things should even be easier without a venv because you don’t have to create a new user with right permissions, remember to activate the environment before running…
I don’t really understand why this is the suggested way of installing home assistant provided that the system python on a system like raspberry is most likely only used for home assistant.
Because HA installs a huge amount of libraries: sensitive things like SSL libraries and often underlying system libraries (to name but one).
Please, I have more than 20 years experience with Python. The fact that you don’t understand is enough reason why you should follow this advice.
Every (good) Python guide out there and HA’s own documentation is advising you to do so. If you don’t follow the recommended installation best practices, then you can’t really expect help.
I tried to create a “test” service just to see in which environment hass is running and I quickly discovered that the PATH environment variable was missing something.
This is what hass was seeing:
'PATH': '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' and this is what an interactive session would have:
Seeing this it was clear that hass would never be able to find either the right pip3.10 or rustc because they are located in /home/pi/.local/bin/pip3.10 and /home/pi/.cargo/bin/rustc, respectively.
I’m not creating a venv and a new user not because I don’t know how to do that, but because I find it unnecessary in this case.
Most HA guides advise people to install into a venv because they are targeted towards users that don’t really know how to maintain their own Python installation. But I do maintain my own installation, and I want to clutter my environment as little as possible.
I already had to install a new environment just for python 3.10 (as Home Assistant already deprecated 3.9) and I’ll shortly have to do the same for Python 3.11 (please stop deprecating so fast ).
I hear your point, just agree to disagree Especially since, in this case, the problem arises from the way hass is called from systemd and not really from the fact that hass is installed into a venv.
I understand that for most of the people the deprecation is a non-issue (as they’re running in Docker or directly into a system installation) but for the small percentage of the users having raspbian maintaining Home Assistant is becoming quite hard… Just saying