Core: Xiaomi Gateway (Aqara) does not work in 0.57.0

Created on 4 Nov 2017  路  21Comments  路  Source: home-assistant/core

Home Assistant release (hass --version): 0.57.0

Python release (python3 --version): Python 3.5.3

Component/platform: Xiaomi Gateway (Aqara)

Description of problem: xiaomi-aqara component throws an error when HA starts up

2017-11-04 13:34:34 ERROR (Thread-4) [homeassistant.util.package] Unable to install package PyXiaomiGateway==0.6.0: Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-2pbjktp3/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-hbzeyvsc-record/install-record.txt --single-version-externally-managed --prefix  --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-2pbjktp3/cffi/
2017-11-04 13:34:34 ERROR (MainThread) [homeassistant.setup] Not initializing xiaomi_aqara because could not install dependency PyXiaomiGateway==0.6.0
2017-11-04 13:34:34 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Could not install all requirements.

Expected:

xiaomi-aqara component to work as did on ver 0.56.1

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

xiaomi_aqara:
  discovery_retry: 5
  gateways:
#    - mac:
    - key: xxxxxxxxxxxxx



    1. 2.
  1. 3.

Traceback (if applicable):


Additional info:

Most helpful comment

I solved my issue with the following comands:
sudo apt-get update
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
sudo pip3 install cryptography
sudo pip3 install PyXiaomiGateway==0.6.0

All 21 comments

I am also having the same issue. I just tried to manually run "pip3 install 'PyXiaomiGateway==0.6.0'" and got the error https://imgur.com/a/qty1W

The below command worked for me, as a manual work around.

sudo pip install PyXiaomiGateway==0.6.0

If I do that I get an error. I had to run "pip3 install --upgrade setuptools" then "pip install PyXiaomiGateway==0.6.0" and it appears to work now.

In my case, compilation of cryptography Python package (which is one of dependencies) failed. Installing libffi development package solved the problem (sudo apt-get install libffi-dev).

It did work for me on Hass.io without any tweaks.

I had to run "pip3 install --upgrade setuptools" then "pip install PyXiaomiGateway==0.6.0" and it works now

It didn't work for me.
My hass runs on RPI with virtualenv.
I try what @12nick12 and @leppa suggested.
Checkout my output : here

I run mine without virtualenv. I wasn't able to pull up any quick search results with that error unfortunately.

I hit the same issue on a Virtualenv based installation on a Raspberry Pi with HA 0.57.0 and Python 3.4.2.

I installed libffi-dev to fulfill the cryptography dependencies but still, when I try to install PyXiaomiGateway==0.6.0 manually, I get the following error:

(test) pi@biniberry:~ $ pip3 install PyXiaomiGateway==0.6.0
Downloading/unpacking PyXiaomiGateway==0.6.0
  Downloading PyXiaomiGateway-0.6.0.tar.gz
  Running setup.py (path:/tmp/pip-build-6i8ijs9b/PyXiaomiGateway/setup.py) egg_info for package PyXiaomiGateway

Downloading/unpacking cryptography==2.1.1 (from PyXiaomiGateway==0.6.0)
  Downloading cryptography-2.1.1.tar.gz (441kB): 441kB downloaded
  Running setup.py (path:/tmp/pip-build-6i8ijs9b/cryptography/setup.py) egg_info for package cryptography
    error in cryptography setup command: Invalid environment marker: python_version < '3'
    Complete output from command python setup.py egg_info:
    error in cryptography setup command: Invalid environment marker: python_version < '3'

For now I've just modified https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/xiaomi_aqara.py#L12 and revert it to PyXiaomiGateway==0.5.3. Not ideal, but now I can start HA.

Maybe @Danielhiversen, as PyXiaomiGateway maintainer, can shed some light on this matter.

To fix that issue error in cryptography setup command: Invalid environment marker: python_version < '3' I ran the pip3 install --upgrade setuptools

PyXiaomiGateway 0.6.0 depends on cryptography. So it will not work with out that library

Excuse my ignorance, but isn鈥檛 there any mechanism to handle the lib dependency chains in HA or PyXiamoGateway in a more seamless manner?

@madrover It works most of the times. If it does not work, then you have to follow the entire manual update process.

A little update, as @leppa mentionned on the forum, for my remaining issue (openssl), I had to install libssl-dev which is not included in a fresh install of strech on Pi.

FYI the issue seems to be resolved with the recent update 0.57.1. No manual update required ;)

Dependencies are retained between upgrades. So if you had installed the correct version in 0.57, home assistant doesn't try to install the dependency again in 0.57.1, if the required version stays the same.

This looks like an issue on the dependency of "cryptography". Looking at its documentation https://cryptography.io/en/latest/installation/. I need to install both "libssl-dev" and "libffi-dev" on Debian but it seems to work fine for me with just "libssl-dev" installed.

I solved my issue with the following comands:
sudo apt-get update
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
sudo pip3 install cryptography
sudo pip3 install PyXiaomiGateway==0.6.0

It would be great if some of you can help update and improve the documentation. In the upper right corner of any documentation page, you will find "Edit this page on GitHub". Follow the link and submit your suggested change. Demonstrated here: https://youtu.be/dRfk9JAlPJk?t=1h16m17s

Suggestions from @s3Pol solved my problems too. Thank you!

I'm unable to complete installation on a Synology NAS... and apt-get is not available here to download libssl-dev dependencies :-(

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ofuangka picture ofuangka  路  3Comments

flsabourin picture flsabourin  路  3Comments

MartinHjelmare picture MartinHjelmare  路  3Comments

kirichkov picture kirichkov  路  3Comments

arangates picture arangates  路  3Comments