Upgrade failure

been awhile since I upgraded (was on .62) and when I tried to upgrade this morning the upgrade failed. Here is the console output:

(homeassistant) pi@raspberrypi:~/homeassistant $ sudo python3 -m pip install --upgrade homeassistant
Collecting homeassistant
  Downloading https://files.pythonhosted.org/packages/91/73/7c94360e60ea73cacaf4c30ce19bbfa6b8b03921dc81462c22f2735e206f/homeassistant-0.68.1-py2.py3-none-any.whl (2.5MB)
    100% |████████████████████████████████| 2.5MB 114kB/s 
Collecting attrs==17.4.0 (from homeassistant)
  Downloading https://files.pythonhosted.org/packages/b5/60/4e178c1e790fd60f1229a9b3cb2f8bc2f4cc6ff2c8838054c142c70b5adc/attrs-17.4.0-py2.py3-none-any.whl
Collecting pip>=8.0.3 (from homeassistant)
  Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 218kB/s 
Collecting astral==1.6 (from homeassistant)
  Downloading https://files.pythonhosted.org/packages/5c/13/6f099c94ef58b154845a44830abe5eb213ce1ffba0e49c451f5620ba241a/astral-1.6-py2.py3-none-any.whl
Collecting voluptuous==0.11.1 (from homeassistant)
  Downloading https://files.pythonhosted.org/packages/f5/09/a0e20a0bd743131e237128bad3a4f83b283f70c032b7e7c0f06baf7f6862/voluptuous-0.11.1-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from homeassistant)
  Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
    100% |████████████████████████████████| 153kB 1.2MB/s 
Collecting typing<4,>=3 (from homeassistant)
  Downloading https://files.pythonhosted.org/packages/05/2b/2b05bf1d5a9dd450447c9a5df3e118a465e5d3cb12b73b7220a5064a403f/typing-3.6.4-py3-none-any.whl
Requirement already up-to-date: jinja2>=2.10 in /usr/local/lib/python3.5/dist-packages (from homeassistant)
Collecting pytz>=2017.02 (from homeassistant)
  Downloading https://files.pythonhosted.org/packages/dc/83/15f7833b70d3e067ca91467ca245bae0f6fe56ddc7451aa0dc5606b120f2/pytz-2018.4-py2.py3-none-any.whl (510kB)
    100% |████████████████████████████████| 512kB 517kB/s 
Collecting async-timeout==2.0.1 (from homeassistant)
  Downloading https://files.pythonhosted.org/packages/1d/b9/213521db2918b5b7f7df333a33ea3d38ba70ba705d9db6c29f0343c213ea/async_timeout-2.0.1-py3-none-any.whl
Requirement already up-to-date: pyyaml<4,>=3.11 in /usr/local/lib/python3.5/dist-packages (from homeassistant)
Requirement already up-to-date: requests==2.18.4 in /usr/local/lib/python3.5/dist-packages (from homeassistant)
Collecting aiohttp==3.1.3 (from homeassistant)
  Downloading https://www.piwheels.hostedpi.com/simple/aiohttp/aiohttp-3.1.3-cp35-cp35m-linux_armv7l.whl (627kB)
    100% |████████████████████████████████| 634kB 140kB/s 
Exception:
Traceback (most recent call last):
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 391, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 387, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse
    response.begin()
  File "/usr/lib/python3.5/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.5/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
    wb.build(autobuilding=True)
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 487, in _prepare_file
    req_to_install, finder)
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 428, in _check_skip_installed
    req_to_install, upgrade_allowed)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 792, in get_page
    "Cache-Control": "max-age=600",
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python3/dist-packages/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
    total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

I also figured I’d try to start it up in spite of the failure to see if it threw any informative errors. This is what i got:

(homeassistant) pi@raspberrypi:~/homeassistant $ sudo systemctl start hass.service
(homeassistant) pi@raspberrypi:~/homeassistant $ sudo systemctl status hass.service
● hass.service - Home Assistant
   Loaded: loaded (/lib/systemd/system/hass.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2018-05-03 13:08:31 EDT; 17s ago
  Process: 3682 ExecStart=/home/pi/homeassistant/bin/hass -c /home/pi/.homeassistant (code=exited, status=1/FAILURE)
 Main PID: 3682 (code=exited, status=1/FAILURE)

May 03 13:08:31 raspberrypi hass[3682]:   File "/home/pi/homeassistant/lib/python3.5/site-packages/homeassistant/setu
May 03 13:08:31 raspberrypi hass[3682]:     from homeassistant import requirements, core, loader, config as conf_util
May 03 13:08:31 raspberrypi hass[3682]:   File "/home/pi/homeassistant/lib/python3.5/site-packages/homeassistant/requ
May 03 13:08:31 raspberrypi hass[3682]:     import homeassistant.util.package as pkg_util
May 03 13:08:31 raspberrypi hass[3682]:   File "/home/pi/homeassistant/lib/python3.5/site-packages/homeassistant/util
May 03 13:08:31 raspberrypi hass[3682]:     from pip.locations import running_under_virtualenv
May 03 13:08:31 raspberrypi hass[3682]: ImportError: No module named 'pip.locations'
May 03 13:08:31 raspberrypi systemd[1]: hass.service: Main process exited, code=exited, status=1/FAILURE
May 03 13:08:31 raspberrypi systemd[1]: hass.service: Unit entered failed state.
May 03 13:08:31 raspberrypi systemd[1]: hass.service: Failed with result 'exit-code'.

Can anyone help me figure out what is going on?

Thank you very much.

What version of python are you running?

2.7.13

Interestingly, i just upgraded to pip 10 and now got through the .68 install successfully. But startup still throws this error:

pi@raspberrypi:~/homeassistant $ sudo systemctl start hass.service
pi@raspberrypi:~/homeassistant $ sudo systemctl status hass.service
● hass.service - Home Assistant
   Loaded: loaded (/lib/systemd/system/hass.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2018-05-03 13:35:23 EDT; 5s ago
  Process: 4228 ExecStart=/home/pi/homeassistant/bin/hass -c /home/pi/.homeassistant (code=exited, status=1/FAILURE)
 Main PID: 4228 (code=exited, status=1/FAILURE)

May 03 13:35:23 raspberrypi hass[4228]:   File "/home/pi/homeassistant/lib/python3.5/site-packages/homeassistant/setu
May 03 13:35:23 raspberrypi hass[4228]:     from homeassistant import requirements, core, loader, config as conf_util
May 03 13:35:23 raspberrypi hass[4228]:   File "/home/pi/homeassistant/lib/python3.5/site-packages/homeassistant/requ
May 03 13:35:23 raspberrypi hass[4228]:     import homeassistant.util.package as pkg_util
May 03 13:35:23 raspberrypi hass[4228]:   File "/home/pi/homeassistant/lib/python3.5/site-packages/homeassistant/util
May 03 13:35:23 raspberrypi hass[4228]:     from pip.locations import running_under_virtualenv
May 03 13:35:23 raspberrypi hass[4228]: ImportError: No module named 'pip.locations'
May 03 13:35:23 raspberrypi systemd[1]: hass.service: Main process exited, code=exited, status=1/FAILURE
May 03 13:35:23 raspberrypi systemd[1]: hass.service: Unit entered failed state.
May 03 13:35:23 raspberrypi systemd[1]: hass.service: Failed with result 'exit-code'.

How did you install? HassIO, Hassbaian, virtual env install?

3.5.3 is the minimum version as of a recent update.

try entereing python3 --version to get the python 3 version you are running. I think just entering python --version defaults to the pyton 2 versions on some OSes.

yeah, sorry I wasn’t using python3 --version to check. When I do I get 3.5.3

pi@raspberrypi:~ $ python3 --version
Python 3.5.3
pi@raspberrypi:~ $ 

oh, and I neglected to answer the second part of your question. This is a virtualenv install on Python3 on Raspbian Stretch…has always worked well before but this is the first time I waited this long between HASS versions before upgrading. Looks like I may have missed some of the action for the past six months or so!

what does the home-assistant.log in your config directory say?

you’re upgrade steps are not right, you should not be calling the upgrade with sudo you need to first become the home assistant user, then activate teh environment before running update without sudo

thanks all. I ended up fixing this by deleting my old virtual environment and creating a brand new one and installing home assistant in that.