Upgrade homeassistant on mac os but not relfecting

Hi, I did upgrade homeassistant on mac mini. The upgrade has gone successfully but’s not reflecting on the gui page still reflecting the old version 0.67.1. Any idea?

$ python3 --version
Python 3.6.4
$ hass -script --version
0.67.1
$ pip3 install homeassistant
Requirement already satisfied: homeassistant in /usr/local/lib/python3.6/site-packages (0.69.1)
Requirement already satisfied: requests==2.18.4 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2.18.4)
Requirement already satisfied: jinja2>=2.10 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2.10)
Requirement already satisfied: astral==1.6.1 in /usr/local/lib/python3.6/site-packages (from homeassistant) (1.6.1)
Requirement already satisfied: pytz>=2017.02 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2018.4)
Requirement already satisfied: voluptuous==0.11.1 in /usr/local/lib/python3.6/site-packages (from homeassistant) (0.11.1)
Requirement already satisfied: typing<4,>=3 in /usr/local/lib/python3.6/site-packages (from homeassistant) (3.6.4)
Requirement already satisfied: aiohttp==3.1.3 in /usr/local/lib/python3.6/site-packages (from homeassistant) (3.1.3)
Requirement already satisfied: attrs==18.1.0 in /usr/local/lib/python3.6/site-packages (from homeassistant) (18.1.0)
Requirement already satisfied: pyyaml<4,>=3.11 in /usr/local/lib/python3.6/site-packages (from homeassistant) (3.12)
Requirement already satisfied: pip>=8.0.3 in /usr/local/lib/python3.6/site-packages (from homeassistant) (10.0.1)
Requirement already satisfied: async-timeout==2.0.1 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2.0.1)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2018.4.16)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests==2.18.4->homeassistant) (1.22)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests==2.18.4->homeassistant) (3.0.4)
Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests==2.18.4->homeassistant) (2.6)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.6/site-packages (from jinja2>=2.10->homeassistant) (1.0)
Requirement already satisfied: idna-ssl>=1.0 in /usr/local/lib/python3.6/site-packages (from aiohttp==3.1.3->homeassistant) (1.0.1)
Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.6/site-packages (from aiohttp==3.1.3->homeassistant) (1.1.1)
Requirement already satisfied: multidict<5.0,>=4.0 in /usr/local/lib/python3.6/site-packages (from aiohttp==3.1.3->homeassistant) (4.2.0)
$

Is ‘hass’ in a directory that was set up to be a virtualenv? Your pip3 command as-is looks like it’s updating the “system” python libraries (via MacPorts or Homebrew). The ‘hass’ script could be invoking a virtualenv that you previously installed home assistant into.

I’m running home assistant on macOS on a Mac Mini, with the MacPorts version of python. I installed home assistant into a virtualenv, and in my installation, the resulting executable script ‘hass’ uses the virtualenv that it was installed in.

1 Like

I think that was the result when I updated the python to 3 via homebrew. I used to able to upgrade with pip install homeassistant but stop working after I upgrade mac os.
What is the command I can check that and do the upgrade?

Did you initially install home asssistant into a python virtualenv? Look in the directory that the ‘hass’ script is in, and see if there’s an ‘activate’ script. If so, then source it into your shell before running the pip upgrade command.

For example, I created a virtualenv in /Users/louie/homeassistant and there’s a /Users/louie/homeassistant/bin directory that contains /Users/louie/homeassistant/bin/hass and /Users/louie/homeassistant/bin/activate

So when I update home assistant, I do

source /Users/louie/homeassistant/bin/activate
pip3 install --upgrade homeassistant 

When I do the source command, it updates the running instance of the shell’s PATH environment variable as well as fiddling other stuff so that python uses the locally installed environment.

1 Like

I installed home assistant by following this - Installation - Home Assistant

Usually I just run the following command up upgrade homeassistant

sudo -H pip3 install --upgrade homeassistant

There is no ‘hass’ created or bin directory in the homeassistant folder…

Perhaps your path has changed, and you’re getting the system python vs. the homebrew python; each would have a different idea of where the libraries are, and maybe each their own version of pip.

If you find which version of hass you’re running, maybe it will give you a clue? For instance, mine looks like this:

#!/Users/louie/homeassistant/bin/python3.5

# -*- coding: utf-8 -*-
import re
import sys

from homeassistant.__main__ import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

Note the very first line which points to the virtualenv python instance that I set up. Maybe the path to the python interpreter in your hass file will give you a hint as to which python installation hass is trying to use vs. what instance of pip3 that you’re running the shell?

Thank for the reply…That may be true because of the homebrew taking over the system python…

The path homeassistant is relaying on /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6
I’d have to dig around to see where is the main files controlling it…

You should see what version of pip3 you are running from the shell; it sounds like it might be the homebrew version, which will put the new libraries into a different spot than where the system version of python lives. Try which pip3 and see what you find.

On my system (where I’m using a virtualenv), this is what happens:

louie@ha[16] $ which pip3
/opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/pip3
louie@ha[17] $ which python3.5
/opt/local/bin/python3.5
louie@ha[18] $ ls -l /opt/local/bin/python3.5
lrwxr-xr-x  1 root  admin  73 Sep 22  2017 /opt/local/bin/python3.5@ -> /opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
louie@ha[19] $ . ~/homeassistant/bin/activate
(homeassistant) louie@ha[20] $ which pip3
/Users/louie/homeassistant/bin/pip3
(homeassistant) louie@ha[21] $ which python3.5
/Users/louie/homeassistant/bin/python3.5
(homeassistant) louie@ha[22] $ ls /opt/local/bin/pip-3.5
/opt/local/bin/pip-3.5@
(homeassistant) louie@ha[23] $ ls -l !$
ls -l /opt/local/bin/pip-3.5
lrwxr-xr-x  1 root  admin  67 Nov  6  2016 /opt/local/bin/pip-3.5@ -> /opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/pip
(homeassistant) louie@ha[24] $

In command 19, I activate the virtualenv and you see now that pip3 and python3.5 are the local versions. This latter bit might not be applicable to you. I use MacPorts, which generally install all its stuff under /opt/local/ which is evident in the paths.

Thanks! I see the problem now…
The pip3 install the directory /usr/local/bin/ but not the /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6.

Do you know how can I upgrade the package in /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 ?

$ which pip3
/usr/local/bin/pip3
$ which python3.6
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6
$ pip3 install homeassistant
Requirement already satisfied: homeassistant in /usr/local/lib/python3.6/site-packages (0.69.1)
Requirement already satisfied: requests==2.18.4 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2.18.4)
Requirement already satisfied: aiohttp==3.1.3 in /usr/local/lib/python3.6/site-packages (from homeassistant) (3.1.3)
Requirement already satisfied: jinja2>=2.10 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2.10)
Requirement already satisfied: pip>=8.0.3 in /usr/local/lib/python3.6/site-packages (from homeassistant) (10.0.1)
Requirement already satisfied: attrs==18.1.0 in /usr/local/lib/python3.6/site-packages (from homeassistant) (18.1.0)
Requirement already satisfied: async-timeout==2.0.1 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2.0.1)
Requirement already satisfied: typing<4,>=3 in /usr/local/lib/python3.6/site-packages (from homeassistant) (3.6.4)
Requirement already satisfied: voluptuous==0.11.1 in /usr/local/lib/python3.6/site-packages (from homeassistant) (0.11.1)
Requirement already satisfied: pytz>=2017.02 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2018.4)
Requirement already satisfied: pyyaml<4,>=3.11 in /usr/local/lib/python3.6/site-packages (from homeassistant) (3.12)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from homeassistant) (2018.4.16)
Requirement already satisfied: astral==1.6.1 in /usr/local/lib/python3.6/site-packages (from homeassistant) (1.6.1)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests==2.18.4->homeassistant) (1.22)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests==2.18.4->homeassistant) (3.0.4)
Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests==2.18.4->homeassistant) (2.6)
Requirement already satisfied: idna-ssl>=1.0 in /usr/local/lib/python3.6/site-packages (from aiohttp==3.1.3->homeassistant) (1.0.1)
Requirement already satisfied: multidict<5.0,>=4.0 in /usr/local/lib/python3.6/site-packages (from aiohttp==3.1.3->homeassistant) (4.2.0)
Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.6/site-packages (from aiohttp==3.1.3->homeassistant) (1.1.1)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.6/site-packages (from jinja2>=2.10->homeassistant) (1.0)

I’m not sure how you ended up with python3 stuff under the /Library/Frameworks/Python.framework/Versions/3.6 directory. Perhaps there’s a pip3 in /Library/Frameworks/Python.framework/Versions/3.6/bin/ that points to this installation when it installs packages?

I don’t think Apple supplies any version 3.x Python installations, and the 2.7 version they supply is under /System/Library/Frameworks/Python.framework/ instead. Sorry I can’t offer any more specific advice; I’ve mostly just used the version from MacPorts myself.

no worries, thanks for the hep… will try to search around…

Finally, managed to solve it. First find the activate source as you shown before.
Then source that activate folder and updated!

Thank you for your help!

$ find / -name activate

$ source /usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/venv/scripts/common/activate
VENV_PROMPT$ python3 -m pip install --upgrade homeassistant

This is really curious; I wouldn’t have thought that you’d create a virtualenv for a whole system installation like that; usually you use python virtual environments on a project-by-project basis.

I just followed the instruction in https://www.home-assistant.io/docs/installation/macos/
At first, it was done by using pip until the python 2 became depreciated…