Core: 0.58.0.dev0 isn't starting properly, no WebUI

Created on 11 Nov 2017  路  16Comments  路  Source: home-assistant/core

Home Assistant release (hass --version):
0.58.0.dev0

Python release (python3 --version):
Python 3.5.3

Component/platform:
Raspberry Pi 3

cat /etc/debian_version 
9.1

Description of problem:
Dev branch isn't starting up properly with a bunch on exceptions around aiohttp

Expected:

Hass running properly with web interface

  1. Install dev release
    pip3 install --upgrade git+git://github.com/home-assistant/home-assistant.git@dev
  2. Run it
    hass
  3. Note exceptions in early startup process

Traceback (if applicable):

2017-11-11 12:01:39 ERROR (MainThread) [homeassistant.loader] Error loading homeassistant.components.history. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 142, in get_component
    module = importlib.import_module(path)
  File "/srv/homeassistant/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/history.py", line 20, in <module>
    from homeassistant.components.http import HomeAssistantView
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/__init__.py", line 30, in <module>
    from .auth import auth_middleware
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/auth.py", line 8, in <module>
    from aiohttp.web import middleware
ImportError: cannot import name 'middleware'

Additional info:
I'm trying to run dev version to test IKEA Tradfri update following recent bridge upgrade

Most helpful comment

Pretty sure this is a bug also. I get the same error about aiohttp: ImportError: cannot import name 'middleware'

All 16 comments

Would this be related to the (further) separation of the frontend and core that happened recently? @armills @andrey-git or @balloob ?

Run scripts/setup

Yep, make sure your dependencies are all correctly installed.

@balloob Shouldn't it be tagged as a packaging bug at least or documentation bug? Isn't there something wrong with the dependencies not automatically deployed, if that's the problem?

aiohttp==2.3.2 is collected and installed, but still :

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 142, in get_component
    module = importlib.import_module(path)
  File "/srv/homeassistant/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/history.py", line 20, in <module>
    from homeassistant.components.http import HomeAssistantView
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/__init__.py", line 30, in <module>
    from .auth import auth_middleware
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/http/auth.py", line 8, in <module>
    from aiohttp.web import middleware
ImportError: cannot import name 'middleware'

@andrey-git I'm using pip to install so I don't really have the repo to run the setup script.

Dirty fix, I added from aiohttp.web import middleware in bin/hass/ then it runs correctly, it actually runs installation of components like these. It didn't get a chance before :

2017-11-17 07:44:32 INFO (Thread-2) [homeassistant.util.package] Attempting install of home-assistant-frontend==20171117.1
2017-11-17 07:44:45 INFO (Thread-5) [homeassistant.util.package] Attempting install of sqlalchemy==1.1.15

Looks like a bug to me.

aiohttp is a core dependency, so if you installing via pip it should be installed as homeassistant dependency.

It is actually installed. But I had to import it manually in hass script otherwise it wouldn't be loaded with the backtrace error you see.

Your environment is probably dirty and you have 2 aiohttp installed. Run pip3 uninstall aiohttp a couple of times 馃槈

No, I cleared the virtualenv.

pip3 install --upgrade git+git://github.com/home-assistant/home-assistant.git@dev
[...]
Collecting aiohttp==2.3.2 (from homeassistant==0.58.0.dev0)
[...]

But still the same exception unless I import manually in the main script.

Same issue trying to upgrade to 0.58 (not dev). Used @ybizeul fix above.

Checking the depencies to fix them.

Pretty sure this is a bug also. I get the same error about aiohttp: ImportError: cannot import name 'middleware'

Still present with v0.58.1, same fix worked.

0.62.1, same. At this point not sure what I'm supposed to do...

@balloob, you closed this without even checking. This is a bug, it is relevant, I shouldn't have to install dependencies as pip is supposed to take care of it, and I honestly don't know what dependency would be missing...

aiocoap==0.4a1
aiohttp==2.3.7
aiohttp-cors==0.6.0
astral==1.4
async-timeout==2.0.0
certifi==2018.1.18
chardet==3.0.4
colorlog==3.0.1
Cython==0.27.3
distro==1.2.0
DTLSSocket==0.1.7
enum-compat==0.0.2
fuzzywuzzy==0.16.0
home-assistant-frontend==20180130.0
homeassistant==0.62.1
idna==2.6
Jinja2==2.10
MarkupSafe==1.0
multidict==4.1.0
mutagen==1.39
netdisco==1.2.4
netifaces==0.10.6
PlexAPI==3.0.5
protobuf==3.5.1
PyChromecast==1.0.3
PyDispatcher==2.0.5
python-openzwave==0.4.0.35
pytradfri==4.1.0
pytz==2017.3
PyYAML==3.12
requests==2.18.4
six==1.11.0
SQLAlchemy==1.2.1
tinyDTLS==0.0.0
tqdm==4.19.5
typing==3.6.4
ua-parser==0.7.3
urllib3==1.22
user-agents==1.1.0
voluptuous==0.10.5
websocket-client==0.46.0
yarl==0.18.0
zeroconf==0.19.1

Are you running within a python virtual environment? If not, I would suggest you try installing in a new virtual environment. In my experience that solves most dependency issues where pip is involved.

Thanks Martin. Yes it鈥檚 in its own venv

@ybizeul do you have traces of old aiohttp files in your homeassistant directory /deps? If so delete or move them elsewhere and try again.

Was this page helpful?
0 / 5 - 0 ratings