Hassbian: Upgrade to 0.66.1 fails

I followed the instructions on https://www.home-assistant.io/docs/installation/hassbian/common-tasks/#update-home-assistant

Unfortunately upgrade fails with following output:

(homeassistant) homeassistant@hassbian:/home/pi $ pip3 install --upgrade homeassistant
Collecting homeassistant
  Using cached homeassistant-0.66.1-py2.py3-none-any.whl
Requirement already up-to-date: pip>=8.0.3 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: voluptuous==0.11.1 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: pyyaml<4,>=3.11 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: astral==1.6 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: jinja2>=2.10 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: aiohttp==3.0.9 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: pytz>=2017.02 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: requests==2.18.4 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: certifi>=2017.4.17 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: typing<4,>=3 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: attrs==17.4.0 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: async-timeout==2.0.1 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: MarkupSafe>=0.23 in /srv/homeassistant/lib/python3.5/site-packages (from jinja2>=2.10->homeassistant)
Requirement already up-to-date: chardet<4.0,>=2.0 in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.0.9->homeassistant)
Requirement already up-to-date: idna-ssl>=1.0 in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.0.9->homeassistant)
Requirement already up-to-date: yarl<2.0,>=1.0 in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.0.9->homeassistant)
Requirement already up-to-date: multidict<5.0,>=4.0 in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.0.9->homeassistant)
Requirement already up-to-date: idna<2.7,>=2.5 in /srv/homeassistant/lib/python3.5/site-packages (from requests==2.18.4->homeassistant)
Requirement already up-to-date: urllib3<1.23,>=1.21.1 in /srv/homeassistant/lib/python3.5/site-packages (from requests==2.18.4->homeassistant)
Installing collected packages: homeassistant
  Found existing installation: homeassistant 0.65.4
Exception:
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_install.py", line 694, in uninstall
    for path in pip.wheel.uninstallation_paths(dist):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/wheel.py", line 534, in unique
    for item in fn(*args, **kw):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/wheel.py", line 553, in uninstallation_paths
    r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1472, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1469, in get_metadata
    return value.decode('utf-8') if six.PY3 else value
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf4 in position 1325: invalid continuation byte

I also tried

sudo apt-get update
sudo apt-get -y upgrade
sudo reboot

before. Nothing helped. Any idea whats going wrong? The older version 0.65.4 still starts fine.

It looks like you have an issue with pip, try upgrading that first.

sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate
pip3 install --upgrade pip
pip3 install --upgrade homeassistant
exit

Many thanks for your reply, but pip is up-to-date:

pi@hassbian:~ $ sudo systemctl stop [email protected]
pi@hassbian:~ $ sudo su -s /bin/bash homeassistant
homeassistant@hassbian:/home/pi $ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@hassbian:/home/pi $ pip3 install --upgrade pip
Requirement already up-to-date: pip in /srv/homeassistant/lib/python3.5/site-packages

Upgrading homeassistant still fails with same stacktrace.

Could be something else then…
Since you are running hassbian, can you try this:

sudo hassbian-config upgrade hassbian-script

And then:

sudo hassbian-config upgrade homeassistant

I’ve run the suggested commands as user pi, since user homeassistant cannot sudo

pi@hassbian:~ $ sudo hassbian-config upgrade hassbian-script                                                                                                                                                                                                 
Hassbian-Script upgrade script for Hassbian                                                                                                                                                                                                                  
Original concept by Ludeeus <https://github.im/Ludeeus>                                                                                                                                                                                                      
Changing to temporary folder                                                                                                                                                                                                                                 
Downloading newest release                                                                                                                                                                                                                                   
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                                                                                                                                                              
                                 Dload  Upload   Total   Spent    Left  Speed                                                                                                                                                                                
100  3924  100  3924    0     0   6651      0 --:--:-- --:--:-- --:--:--  6650                                                                                                                                                                               
Installing newest release                                                                                                                                                                                                                                    
(Reading database ... 60969 files and directories currently installed.)
Preparing to unpack hassbian-scripts_0.8.1.deb ...
Unpacking hassbian-scripts (0.8.1) over (0.6) ...
Setting up hassbian-scripts (0.8.1) ...
Installing new version of config file /etc/sudoers.d/020_homeassistant_hassbian-scripts ...
Cleanup

Uppgrade is now done.


If you have issues with this script, please say something in the #Hassbian channel on Discord.

/usr/local/bin/hassbian-config: line 72: /srv/homeassistant/hassbian/suite-states: No such file or directory



pi@hassbian:~ $ sudo hassbian-config upgrade homeassistant
Home Assistant install script for Hassbian.
Copyright(c) 2017 Fredrik Lindqvist <https://github.com/Landrash>.

Checking current version
Exception:
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/commands/show.py", line 42, in run
    results, list_files=options.files, verbose=options.verbose):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/commands/show.py", line 125, in print_results
    for i, dist in enumerate(distributions):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/commands/show.py", line 72, in search_packages_info
    lines = dist.get_metadata_lines('RECORD')
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1472, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1469, in get_metadata
    return value.decode('utf-8') if six.PY3 else value
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xea in position 3081: invalid continuation byte
Stopping Home Assistant
Warning: [email protected] changed on disk. Run 'systemctl daemon-reload' to reload units.
Changing to the homeassistant user
Changing to Home Assistant venv
Installing latest version of Home Assistant
Requirement already up-to-date: setuptools in /srv/homeassistant/lib/python3.5/site-packages
Requirement already up-to-date: wheel in /srv/homeassistant/lib/python3.5/site-packages
Collecting homeassistant
  Using cached homeassistant-0.66.1-py2.py3-none-any.whl
Requirement already up-to-date: aiohttp==3.0.9 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: pytz>=2017.02 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: attrs==17.4.0 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: async-timeout==2.0.1 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: pip>=8.0.3 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: requests==2.18.4 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: certifi>=2017.4.17 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: jinja2>=2.10 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: voluptuous==0.11.1 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: astral==1.6 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: pyyaml<4,>=3.11 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: typing<4,>=3 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: multidict<5.0,>=4.0 in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.0.9->homeassistant)
Requirement already up-to-date: idna-ssl>=1.0 in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.0.9->homeassistant)
Requirement already up-to-date: yarl<2.0,>=1.0 in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.0.9->homeassistant)
Requirement already up-to-date: chardet<4.0,>=2.0 in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.0.9->homeassistant)
Requirement already up-to-date: urllib3<1.23,>=1.21.1 in /srv/homeassistant/lib/python3.5/site-packages (from requests==2.18.4->homeassistant)
Requirement already up-to-date: idna<2.7,>=2.5 in /srv/homeassistant/lib/python3.5/site-packages (from requests==2.18.4->homeassistant)
Requirement already up-to-date: MarkupSafe>=0.23 in /srv/homeassistant/lib/python3.5/site-packages (from jinja2>=2.10->homeassistant)
Installing collected packages: homeassistant
  Found existing installation: homeassistant 0.65.4
Exception:
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_install.py", line 694, in uninstall
    for path in pip.wheel.uninstallation_paths(dist):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/wheel.py", line 534, in unique
    for item in fn(*args, **kw):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/wheel.py", line 553, in uninstallation_paths
    r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1472, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1469, in get_metadata
    return value.decode('utf-8') if six.PY3 else value
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xea in position 3081: invalid continuation byte
Deactivating virtualenv
Restarting Home Assistant
Warning: [email protected] changed on disk. Run 'systemctl daemon-reload' to reload units.
Checking the installation...

Upgrade complete..
Note that it may take some time to start up after an upgrade.

The stacktrace is slightly different.

I’ve run

sudo systemctl daemon-reload

without issues and restarted homeassistant. It’s still on 0.65.4.

perfetct, they should be run as pi :slight_smile:

The first stacktrace you get is for this command:
pip3 show homeassistant

There must be something verry wrong with pip…
May try reinstalling that?

I tried (as user homeassistant):

source /srv/homeassistant/bin/activate
pip3 install --upgrade --force-reinstall pip

which didn’t help. Next I tried (as user pi):

sudo apt purge python3-pip
sudo apt install python3-pip

Both without success. I still get the stacktrace when running

pip3 install --upgrade homeassistant

How about this as homeassistant:
pip3 install --upgrade pip==9.0.1

9.0.3 is the newest, but it should try to do something

Downgrading pip worked so far, bat homeassistant forced an update. So I tried both:

(homeassistant) homeassistant@hassbian:/home/pi $ pip3 install --upgrade pip==9.0.1 homeassistant
Requirement already up-to-date: pip==9.0.1 in /srv/homeassistant/lib/python3.5/site-packages
Collecting homeassistant
  Using cached homeassistant-0.66.1-py2.py3-none-any.whl
Requirement already up-to-date: typing<4,>=3 in /srv/homeassistant/lib/python3.5/site-packages (from     homeassistant)
Requirement already up-to-date: pyyaml<4,>=3.11 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: jinja2>=2.10 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: voluptuous==0.11.1 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: async-timeout==2.0.1 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: astral==1.6 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: requests==2.18.4 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: attrs==17.4.0 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: pytz>=2017.02 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: aiohttp==3.0.9 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: certifi>=2017.4.17 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
Requirement already up-to-date: MarkupSafe>=0.23 in /srv/homeassistant/lib/python3.5/site-packages (from jinja2>=2.10->homeassistant)
Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in /srv/homeassistant/lib/python3.5/site-packages (from requests==2.18.4->homeassistant)
Requirement already up-to-date: urllib3<1.23,>=1.21.1 in /srv/homeassistant/lib/python3.5/site-packages (from requests==2.18.4->homeassistant)
Requirement already up-to-date: idna<2.7,>=2.5 in /srv/homeassistant/lib/python3.5/site-packages (from requests==2.18.4->homeassistant)
Requirement already up-to-date: multidict<5.0,>=4.0 in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.0.9->homeassistant)
Requirement already up-to-date: yarl<2.0,>=1.0 in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.0.9->homeassistant)
Requirement already up-to-date: idna-ssl>=1.0 in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.0.9->homeassistant)
Installing collected packages: homeassistant
  Found existing installation: homeassistant 0.65.4
Exception:
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_install.py", line 694, in uninstall
    for path in pip.wheel.uninstallation_paths(dist):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/wheel.py", line 534, in unique
    for item in fn(*args, **kw):
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/wheel.py", line 553, in uninstallation_paths
    r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1472, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/srv/homeassistant/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1469,     in get_metadata
    return value.decode('utf-8') if six.PY3 else value
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf4 in position 1325: invalid continuation byte
You are using pip version 9.0.1, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Meanwhile I think installing from scratch is less time. But I’ve found several requests in the web when trying to find a solution regarding similar issues across different version upgrades.

Before reinstalling try that ^
and/or

pip install --upgrade pip=9.0.3

I think you should try deleting the virtual environment and recreating it, before installing from scratch.

1 Like

I tried both: pip 9.0.3 and pip 9.0.1, nothing worked.

That’s it! Many thanks @gpbenton for this hint. I’m new to python virtual environments, but this solved my problem. Many thanks @ludeeus for all the time you spent to analyze my issue.

1 Like