Manual Install Homeassistant not updating - downloads the files but never updates?

I’m currently stuck on 0.61.1
My configuration files are stored in /home/pi/.homeassistant
whereis hass points to /usr/local/bin/hass
When I execute sudo pip3 install --upgrade homeassistant==0.63.3 I get the following:

Requirement already up-to-date: homeassistant==0.63.3 in /usr/local/lib/python3.5/dist-packages
Requirement already up-to-date: pip>=8.0.3 in /usr/lib/python3/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: pyyaml<4,>=3.11 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: astral==1.5 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: yarl==1.1.0 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: certifi>=2017.4.17 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: jinja2>=2.10 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: pytz>=2017.02 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: typing<4,>=3 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: chardet==3.0.4 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: requests==2.18.4 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: aiohttp==2.3.10 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: attrs==17.4.0 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: voluptuous==0.10.5 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: async-timeout==2.0.0 in /usr/local/lib/python3.5/dist-packages (from homeassistant==0.63.3)
Requirement already up-to-date: idna>=2.0 in /usr/local/lib/python3.5/dist-packages (from yarl==1.1.0->homeassistant==0.63.3)
Requirement already up-to-date: multidict>=4.0 in /usr/local/lib/python3.5/dist-packages (from yarl==1.1.0->homeassistant==0.63.3)
Requirement already up-to-date: MarkupSafe>=0.23 in /usr/local/lib/python3.5/dist-packages (from jinja2>=2.10->homeassistant==0.63.3)
Requirement already up-to-date: urllib3<1.23,>=1.21.1 in /usr/local/lib/python3.5/dist-packages (from requests==2.18.4->homeassistant==0.63.3)
Requirement already up-to-date: idna-ssl>=1.0.0 in /usr/local/lib/python3.5/dist-packages (from aiohttp==2.3.10->homeassistant==0.63.3)

I’ve restarted the service, i’ve even rebooted the pi. The GUI reports the server offline during the reboot (as expected) but still comes back showing version 0.61.1 as being installed.

cat .HA_VERSION from within /home/pi/.homeassistant reports as 0.61.1
Any suggestion where I might have screwed up the install?

Thanks in advance

I assume you have to activate a virtual environment before updating.
Look at the docs where you installed HA.

How are you starting/restarting the service? Show me the contents of that service file, I bet it’s pointing at a different place and starting a different instance of HA.

I didn’t install using a virtual environment

[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=%i
ExecStart=/usr/local/bin/hass
#ExecStart=/home/pi/.local/bin/hass

[Install]
WantedBy=multi-user.target

ps -ef | grep hass shows its running it from the path as per the service file

pi 1637 1 1 Feb19 ? 01:19:49 /usr/bin/python3 /usr/local/bin/hass

Hmm. What’s the name of the service file? Should be something like [email protected].

[email protected]

FWIW I have to use sudo when I run the pip3 install --upgrade command, otherwise it complains about permission denied.

Hope that helps!

OK then, what happens if you run manually from the command line with:
sudo hass
That should work, /usr/local/bin is in the PATH.

I’m thinking if you installed as root it may be in /usr/bin instead of /usr/local/bin?

Can’t log into HASS if I launch as sudo
Creates a new config in a different path

pi@raspberrypi:/etc/systemd/system $ sudo systemctl stop [email protected]
pi@raspberrypi:/etc/systemd/system $ sudo hass
Unable to find configuration. Creating default one in /root/.homeassistant
Config directory: /root/.homeassistant

OK now do:
sudo cat /root/.homeassistant/.HA_VERSION

Does that say it’s 0.63.3?

If not, then I’m not sure what’s going wrong. You can solve this easily by setting up under a venv and changing your service file to point at the venv bin and your local Hass config.

1 Like

Bingo that does indeed say 0.63.3!

So where did I go wrong and what’s the next step to get things back to normal?
I can’t pay you but please help yourself to the pens and envelopes in stationary cupboard :wink:

Well I think the problem is that pip3 install homeassistant installs to a different place than sudo pip3 install homeassistant.

Here’s the quick way to get back on the rails - set up a virtual env:

sudo apt-get install -y python3-venv

mkdir /home/pi/home-assistant

python3 -m venv /home/pi/home-assistant

source /home/pi/home-assistant/bin/activate

python3 -m pip install wheel

python3 -m pip install homeassistant

Now, edit your [email protected] file so that it reads as follows:

[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=%i
ExecStart=/home/pi/home-assistant/bin/hass -c "/home/pi/.homeassistant"

[Install]
WantedBy=multi-user.target

Then do:
sudo daemon-reload
And you should be able to start HA with your old config at version 0.63.3 now by doing:
sudo systemctl start homeassistant@pi

The venv is really the way to go to avoid these types of permissions/versions conflicts. Now your HA install is contained in /home/pi/home-assistant. To upgrade in the future all you have to do is:

sudo systemctl stop homeassistant@pi

source /home/pi/home-assistant/bin/activate

python3 -m pip install --upgrade homeassistant

deactivate

sudo systemctl start homeassistant@pi
1 Like

You sir are a champion, thank you!

I’ll relay this to another forum for somebody else having a similar issue

I have the same problem.
checked all above.
no luck.

running on virtual env

sudo python3 -m pip install –no-cache-dir --upgrade homeassistant
Requirement already up-to-date: homeassistant in /usr/local/lib/python3.5/dist-packages (0.70.1)
Requirement not upgraded as not directly required: certifi>=2018.04.16 in /usr/local/lib/python3.5/dist-packages (from homeassistant) (2018.4.16)
Requirement not upgraded as not directly required: attrs==18.1.0 in /usr/local/lib/python3.5/dist-packages (from homeassistant) (18.1.0)
Requirement not upgraded as not directly required: typing<4,>=3 in /usr/local/lib/python3.5/dist-packages (from homeassistant) (3.6.4)
Requirement not upgraded as not directly required: voluptuous==0.11.1 in /usr/local/lib/python3.5/dist-packages (from homeassistant) (0.11.1)
Requirement not upgraded as not directly required: aiohttp==3.1.3 in /usr/local/lib/python3.5/dist-packages (from homeassistant) (3.1.3)
Requirement not upgraded as not directly required: requests==2.18.4 in /usr/local/lib/python3.5/dist-packages (from homeassistant) (2.18.4)
Requirement not upgraded as not directly required: async-timeout==2.0.1 in /usr/local/lib/python3.5/dist-packages (from homeassistant) (2.0.1)
Requirement not upgraded as not directly required: pyyaml<4,>=3.11 in /usr/lib/python3/dist-packages (from homeassistant) (3.12)
Requirement not upgraded as not directly required: pytz>=2018.04 in /usr/local/lib/python3.5/dist-packages (from homeassistant) (2018.4)
Requirement not upgraded as not directly required: astral==1.6.1 in /usr/local/lib/python3.5/dist-packages (from homeassistant) (1.6.1)
Requirement not upgraded as not directly required: pip>=8.0.3 in /usr/local/lib/python3.5/dist-packages (from homeassistant) (10.0.1)
Requirement not upgraded as not directly required: jinja2>=2.10 in /usr/local/lib/python3.5/dist-packages (from homeassistant) (2.10)
Requirement not upgraded as not directly required: multidict<5.0,>=4.0 in /usr/local/lib/python3.5/dist-packages (from aiohttp==3.1.3->homeassistant) (4.1.0)
Requirement not upgraded as not directly required: idna-ssl>=1.0 in /usr/local/lib/python3.5/dist-packages (from aiohttp==3.1.3->homeassistant) (1.0.1)
Requirement not upgraded as not directly required: yarl<2.0,>=1.0 in /usr/local/lib/python3.5/dist-packages (from aiohttp==3.1.3->homeassistant) (1.1.1)
Requirement not upgraded as not directly required: chardet<4.0,>=2.0 in /usr/local/lib/python3.5/dist-packages (from aiohttp==3.1.3->homeassistant) (3.0.4)
Requirement not upgraded as not directly required: urllib3<1.23,>=1.21.1 in /usr/local/lib/python3.5/dist-packages (from requests==2.18.4->homeassistant) (1.22)
Requirement not upgraded as not directly required: idna<2.7,>=2.5 in /usr/local/lib/python3.5/dist-packages (from requests==2.18.4->homeassistant) (2.6)
Requirement not upgraded as not directly required: MarkupSafe>=0.23 in /usr/local/lib/python3.5/dist-packages (from jinja2>=2.10->homeassistant) (1.0)
(homeassistant) reinan@ReinasServer:/srv/homeassistant$ python3 -m pip install --no-cache-dir --upgrade homeassistant
Collecting homeassistant
Downloading https://files.pythonhosted.org/packages/dd/f2/2ef935add2d07bc1a5e238b94ffe7c680bdc461bc67a19671736d50eae19/homeassistant-0.70.1-py3-none-any.whl (2.6MB)
100% |████████████████████████████████| 2.6MB 688kB/s
Collecting astral==1.6.1 (from homeassistant)
Downloading https://files.pythonhosted.org/packages/01/2b/0b60f1cef7d2a7a863cd06bae5fc7e3553803739c4834e921b4996920f76/astral-1.6.1-py2.py3-none-any.whl
Requirement not upgraded as not directly required: certifi>=2018.04.16 in ./lib/python3.5/site-packages (from homeassistant) (2018.4.16)
Requirement not upgraded as not directly required: jinja2>=2.10 in ./lib/python3.5/site-packages (from homeassistant) (2.10)
Requirement not upgraded as not directly required: pip>=8.0.3 in ./lib/python3.5/site-packages (from homeassistant) (10.0.1)
Requirement not upgraded as not directly required: async-timeout==2.0.1 in ./lib/python3.5/site-packages (from homeassistant) (2.0.1)
Requirement not upgraded as not directly required: voluptuous==0.11.1 in ./lib/python3.5/site-packages (from homeassistant) (0.11.1)
Collecting attrs==18.1.0 (from homeassistant)
Downloading https://files.pythonhosted.org/packages/41/59/cedf87e91ed541be7957c501a92102f9cc6363c623a7666d69d51c78ac5b/attrs-18.1.0-py2.py3-none-any.whl
Requirement not upgraded as not directly required: requests==2.18.4 in ./lib/python3.5/site-packages (from homeassistant) (2.18.4)
Requirement not upgraded as not directly required: aiohttp==3.1.3 in ./lib/python3.5/site-packages (from homeassistant) (3.1.3)
Requirement not upgraded as not directly required: pytz>=2018.04 in ./lib/python3.5/site-packages (from homeassistant) (2018.4)
Requirement not upgraded as not directly required: typing<4,>=3 in ./lib/python3.5/site-packages (from homeassistant) (3.6.4)
Requirement not upgraded as not directly required: pyyaml<4,>=3.11 in ./lib/python3.5/site-packages (from homeassistant) (3.12)
Requirement not upgraded as not directly required: MarkupSafe>=0.23 in ./lib/python3.5/site-packages (from jinja2>=2.10->homeassistant) (1.0)
Requirement not upgraded as not directly required: idna<2.7,>=2.5 in ./lib/python3.5/site-packages (from requests==2.18.4->homeassistant) (2.6)
Requirement not upgraded as not directly required: urllib3<1.23,>=1.21.1 in ./lib/python3.5/site-packages (from requests==2.18.4->homeassistant) (1.22)
Requirement not upgraded as not directly required: chardet<3.1.0,>=3.0.2 in ./lib/python3.5/site-packages (from requests==2.18.4->homeassistant) (3.0.4)
Requirement not upgraded as not directly required: multidict<5.0,>=4.0 in ./lib/python3.5/site-packages (from aiohttp==3.1.3->homeassistant) (4.3.1)
Requirement not upgraded as not directly required: yarl<2.0,>=1.0 in ./lib/python3.5/site-packages (from aiohttp==3.1.3->homeassistant) (1.2.3)
Requirement not upgraded as not directly required: idna-ssl>=1.0 in ./lib/python3.5/site-packages (from aiohttp==3.1.3->homeassistant) (1.0.1)
botocore 1.9.21 has requirement python-dateutil<2.7.0,>=2.1, but you’ll have python-dateutil 2.7.2 which is incompatible.
Installing collected packages: astral, attrs, homeassistant
Found existing installation: astral 1.6
Uninstalling astral-1.6:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/srv/homeassistant/lib/python3.5/site-packages/pycache/astral.cpython-35.pyc’
Consider using the --user option or check the permissions.

noote that this is happening runnning from within virtualenv and with sudo and nocachedir option

If you are using a virtual environment you must never use sudo, it runs the command as root and therefore has different permissions to the normal user.

Now you have used it, you have probably altered the permissions of some of the files, which will make it very difficult to recover. Your best option is probably to delete the virtual environment and create a new one. The correct instructions for creating a virtual environment are here

ok.
I will.
Is it safe to just backup the .homeassistant backup folder?
I presume the reinstall want touch anything of the configs (including certs for the webserver)

Thanks

Before a significant change like this, I normally like to do a full system backup (in my case, copying the SD card). Then the worse that can happen is you waste your time.

But changing the virtual environment just alters the python program and packages, so shouldn’t affect your configuration and certificates.