Core: [homeassistant.setup] Error during setup of component zha

Created on 26 Feb 2018  路  13Comments  路  Source: home-assistant/core

Home Assistant release (0.64.0):

Python release (Python 3.6.4):

Component/platform: ZHA

Description of problem:
Upon startup of hass zha fails to start.

Expected:
ZHA starts as before with 0.63.3

Problem-relevant configuration.yaml entries and steps to reproduce:

zha:
  usb_path: /dev/zigbee
  database_path: /config/zigbee.db
  1. docker restart docker-name

Traceback (if applicable):

2018-02-25 19:09:20 ERROR (MainThread) [homeassistant.setup] Error during setup of component zha
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/setup.py", line 145, in _async_setup_component
    result = yield from component.async_setup(hass, processed_config)
  File "/usr/src/app/homeassistant/components/zha/__init__.py", line 96, in async_setup
    from bellows.zigbee.application import ControllerApplication
  File "/usr/local/lib/python3.6/site-packages/bellows/zigbee/application.py", line 7, in <module>
    import zigpy.application
  File "/usr/local/lib/python3.6/site-packages/zigpy/application.py", line 6, in <module>
    import zigpy.appdb
  File "/usr/local/lib/python3.6/site-packages/zigpy/appdb.py", line 4, in <module>
    import zigpy.device
  File "/usr/local/lib/python3.6/site-packages/zigpy/device.py", line 5, in <module>
    import zigpy.endpoint
  File "/usr/local/lib/python3.6/site-packages/zigpy/endpoint.py", line 7, in <module>
    import zigpy.util
  File "/usr/local/lib/python3.6/site-packages/zigpy/util.py", line 6, in <module>
    from Crypto.Cipher import AES
  File "/usr/local/lib/python3.6/site-packages/Crypto/Cipher/__init__.py", line 3, in <module>
    from Crypto.Cipher._mode_ecb import _create_ecb_cipher
  File "/usr/local/lib/python3.6/site-packages/Crypto/Cipher/_mode_ecb.py", line 29, in <module>
    from Crypto.Util._raw_api import (load_pycryptodome_raw_lib,
  File "/usr/local/lib/python3.6/site-packages/Crypto/Util/_raw_api.py", line 32, in <module>
    from Crypto.Util.py3compat import byte_string
ImportError: cannot import name 'byte_string'

Most helpful comment

Looks like the problem is that zigpy鈥檚 setup.py should specify versioned dependencies.

https://github.com/zigpy/zigpy/blob/master/setup.py

All 13 comments

I'm getting the exact same error upon upgrading the docker image.

Other things that I tried that din't resolve the issue:

  • Added radio_type: ezsp
  • Removed the zigbee.db ( The crash is before its able to even create a new db )

Yeah, I am also poking around looking for what could be causing the issue. Also i have noticed that the new august component is not functional. But I'm sure it is unrelated.

Just tried this and the error went away:
https://github.com/home-assistant/home-assistant/issues/2411#issuecomment-230091749

Connect to the docker container:

docker exec -i -t home-assistant /bin/bash

and then:

pip3 uninstall pycrypto
pip3 uninstall pycryptodome
pip3 install pycryptodome

Looks like the devices now have a different device_id, so will need to change everything referring to the device.

binary_sensor.centralite_3305s_03269548_1
became:
binary_sensor.centralite_3305s_03269548_1_1280

and
sensor.centralite_3321s_0bb55b0f_1
became:
sensor.centralite_3321s_0bb55b0f_1_1026

@roblandry that did the trick thanks the workaround.

My devices_id's also rename the same way.

are those devices now in entity_registry.yaml?

@dshokouhi , Yes the new devices show up in the entity_registry.yaml

@roblandry

For bellows cli to work we need to also include pycryptop re-install:

pip3 uninstall pycrypto
pip3 uninstall pycryptodome
pip3 install pycryptodome
pip3 install pycrypto

Looks like the problem is that zigpy鈥檚 setup.py should specify versioned dependencies.

https://github.com/zigpy/zigpy/blob/master/setup.py

Seeing the same thing with #12682 BTW.

Similar to #12702 as well.

I SSH'd into my Hass.io image as root, ran:

docker exec -i -t homeassistant /bin/bash
pip3 uninstall pycrypto
pip3 uninstall pycryptodome

But when I run either install command:

pip3 install pycryptodome
pip3 install pycrypto

I get:

bash-4.4# pip3 install pycryptodome
Collecting pycryptodome
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x75c39770>: Failed to establish a new connection: [Errno -3] Try again',)': /simple/pycryptodome/
  Could not find a version that satisfies the requirement pycryptodome (from versions: )
No matching distribution found for pycryptodome

pycryptodome is a replace of unmaintained and problematic library with name pycrypto. Please don't use this old library and go to pycryptodome. We should block in on home-assistant

12723 #12682 #12702 all seems related

Was this page helpful?
0 / 5 - 0 ratings