home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.45k stars 30.69k forks source link

Unable to initialise device_tracker.bluetooth_le_tracker, error installing dependency gattlib #7851

Closed jcastro closed 7 years ago

jcastro commented 7 years ago

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version): 0.45.1

Python release (python3 --version): Python 3.6.1

Component/platform: Device tracker / Bluetooth LE Tracker

Description of problem: Home Assistant running on docker on unRaid 6.3.5 can't install required gattlib

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

- platform: bluetooth_le_tracker
- platform: bluetooth_tracker

Traceback (if applicable):

2017-06-01 13:37:21 ERROR (<concurrent.futures.thread.ThreadPoolExecutor object at 0x2ac09940fd68>_0) [homeassistant.util.package] Unable to install package gattlib==0.20150805: Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pr8vs_y4/gattlib/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-59cbsf21-record/install-record.txt --single-version-externally-managed --compile --home=/tmp/tmprm5hszgq" failed with error code 1 in /tmp/pip-build-pr8vs_y4/gattlib/
2017-06-01 13:37:21 ERROR (MainThread) [homeassistant.setup] Not initializing device_tracker.bluetooth_le_tracker because could not install dependency gattlib==0.20150805
2017-06-01 13:37:21 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform device_tracker.bluetooth_le_tracker: Could not install all requirements.
2017-06-01 13:37:21 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform bluetooth_tracker
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/device_tracker/__init__.py", line 161, in async_setup_platform
    disc_info)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/device_tracker/bluetooth_tracker.py", line 64, in setup_scanner
    for dev in discover_devices():
  File "/usr/src/app/homeassistant/components/device_tracker/bluetooth_tracker.py", line 42, in discover_devices
    lookup_class=False)
  File "/config/deps/bluetooth/bluez.py", line 26, in discover_devices
    device_id = _bt.hci_get_route()
OSError: [Errno 97] Address family not supported by protocol

Additional info: I'm using official's @balloob unRaid docker image. If trying to install manually gattlib from inside the docker by using pip3 install gattlib I get the following

root@unBeast:/usr/src/app# pip3 install gattlib   
Collecting gattlib
  Using cached gattlib-0.20150805.tar.gz
Building wheels for collected packages: gattlib
  Running setup.py bdist_wheel for gattlib ... error
  Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ui3frnkq/gattlib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp96130q8lpip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_ext
  building 'gattlib' extension
  creating build
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/src
  creating build/temp.linux-x86_64-3.6/src/bluez
  creating build/temp.linux-x86_64-3.6/src/bluez/lib
  creating build/temp.linux-x86_64-3.6/src/bluez/attrib
  creating build/temp.linux-x86_64-3.6/src/bluez/src
  creating build/temp.linux-x86_64-3.6/src/bluez/src/shared
  creating build/temp.linux-x86_64-3.6/src/bluez/btio
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Isrc/bluez -I/usr/local/include/python3.6m -c src/gattservices.cpp -o build/temp.linux-x86_64-3.6/src/gattservices.o
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  In file included from src/gattservices.cpp:12:0:
  src/gattlib.h:11:33: fatal error: boost/python/list.hpp: No such file or directory
   #include <boost/python/list.hpp>
                                   ^
  compilation terminated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for gattlib
  Running setup.py clean for gattlib
Failed to build gattlib
Installing collected packages: gattlib
  Running setup.py install for gattlib ... error
    Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ui3frnkq/gattlib/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-0610butn-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'gattlib' extension
    creating build
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    creating build/temp.linux-x86_64-3.6/src/bluez
    creating build/temp.linux-x86_64-3.6/src/bluez/lib
    creating build/temp.linux-x86_64-3.6/src/bluez/attrib
    creating build/temp.linux-x86_64-3.6/src/bluez/src
    creating build/temp.linux-x86_64-3.6/src/bluez/src/shared
    creating build/temp.linux-x86_64-3.6/src/bluez/btio
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DVERSION="5.25" -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Isrc/bluez -I/usr/local/include/python3.6m -c src/gattservices.cpp -o build/temp.linux-x86_64-3.6/src/gattservices.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    In file included from src/gattservices.cpp:12:0:
    src/gattlib.h:11:33: fatal error: boost/python/list.hpp: No such file or directory
     #include <boost/python/list.hpp>
                                     ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ui3frnkq/gattlib/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-0610butn-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ui3frnkq/gattlib/
fabaff commented 7 years ago

Looks like that boost is missing.

jcastro commented 7 years ago

Umm do you mean on the docker image? or that I should install it manually? thanks!

jcastro commented 7 years ago

Umm tried to manually install boost by doing pip3 install boost. It seems to install perfect with no errors but once I try to install gattlib I get the same error o.O

fabaff commented 7 years ago

No, the C++ library. Something like libboost-python* or boost-python3*.

jcastro commented 7 years ago

umm I couldn't find anything related, but in any case whatever changes I do on the docker image will get replaced when a new version of HA is up :(. I guess we need to fix it from the original image?

Searched "boost"

root@unBeast:/usr/src/app# pip3 search boost
xrpi-test-12.10.16 (0.0.2)           - XGBoost powered RNA-Protein Interaction prediction
glamkit-adminboost (0.0.3)           - Makes the Django admin even more awesomer
alignak_module_nrpe_booster (0.3.2)  - Alignak - Poller module to boost NRPE checks
autowrapt (1.0)                      - Boostrap mechanism for monkey patches.
bob.ip.facedetect (2.1.2)            - Face detection using boosted LBP features
bob.learn.boosting (2.0.11)          - Boosting framework for Bob
bob.paper.SCIA2015 (2.0.4)           - Source code for regenerating the results of the paper "Gender Classification by LUT based
                                       boosting of Overlapping Block Patterns"
boost (0.1)                          - Boost automatically toots from Mastodon users
  INSTALLED: 0.1 (latest)
mkdocs-boost (0.0.2)                 - Boost theme for mkdocs
sphinx-boost (0.0.3)                 - Boost theme for sphinx
larissa-boost (0.0.4)                - Boost library dependency building for larissa
ego-boost (0.1.2)                    - Package to track your module's download statistics
Flask-Turbo-Boost (0.0.10)           - Forked Flask-Boost - Flask application generator for boosting your development.
Flask-Boost (0.7.5)                  - Flask application generator for boosting your development.
boost_queue (0.4.2)                  - Queue using boost's locking API
boost_regex (0.57)                   - Very basic interface to the boost regex library.
Flask-SQLAlchemy-Booster (0.4.96)    - Querying and JSON Response generation wrappers for Flask-SQLAlchemy
boosterpacks (0.2.1)                 - Sample of boosterpack in Star Crusade
boostmpi (1.38.0.1)                  - Boost MPI Python wrappers
cyrand (0.2)                         - Wrapper to Boost random numbers
dask-xgboost (0.1.3)                 - Interactions between Dask and XGBoost
django_speedboost (1.8.8.0)          - Replaces select Django modules with Cython-compiled versions for great speed.
flask_bootstrap_forms (0.4)          - A set of tools that makes it easy to draw HTML forms in Flask in the style of Boostrap.
sklearn-gbmi (1.0.0)                 - Compute Friedman and Popescu's H statistics, in order to look for interactions among variables
                                       in scikit-learn gradient-boosting models.
js.angular_ui_bootstrap (0.6.0-2)    - Fanstatic packaging of Angular UI Boostrap
lunatic (1.1.10)                     - PostgreSQL Python booster utilities
measurepy (0.1)                      - A python module to boost first-step data analysis after measurements.
mlboost (0.4.1)                      - an innovative machine learning library for extreme prototyping
myAdaboost (1.0.0)                   - implimention of myAdaboost and ROC in python,and a test of it
mygraph (0.9.8)                      - Python wrapper of C++ Time-dependent Hyperpath algorithm implementation, requires python-dev,
                                       boost_python, pqxx and hdf5 installed
oggpy (0.5)                          - Boost.Python and C++ wrappers of ogg, vorbis and theora
palmer (0.0.4)                       - Redice Flask Boost Library. Inspired by flask-api.
palvin (0.0.4)                       - Redice SQLAlchemy Boost Library. It's based sqlalchemy-wrapper
pandas_ml (0.4.0)                    - pandas, scikit-learn and xgboost integration
pboost (0.5.4)                       - Parallel Implementation of Boosting Algorithms with MPI.
plonetheme.booster (1.0.7)           - A theme for Plone 5.x
py_date_time (1.33.1)                - Python bindings for C++ boost.date_time library
pydhs (1.5.3)                        - Python wrapper of C++ Hyperpath algorithm implementation, requires python-dev, boost_python
                                       installed
pyexpression (0.1.0)                 - boost.lambda like function generator
PyICL (0.6.15)                       - Exposes the boost.icl interval container library to python
pyodeint (0.8.4)                     - Python binding for odeint from boost.
pyopencv (2.1.0.wr1.2.0)             - PyOpenCV - A Python wrapper for OpenCV 2.x using Boost.Python and NumPy
pyplusplus (0.6.1)                   - pyplusplus is an object-oriented framework for creating a code generator for boost.python
                                       library
PythonFormat (0.1.1)                 - PyFormat - boost::format python module
pyvoronoi (1.0.4)                    - Cython wrapper for the Boost Voronoi library (version 1.59.0)
shoutpy (1.0.0)                      - Boost.Python bindings for libshout >= 2.1
xgbfir (0.2)                         - Xgbfir is a XGBoost model dump parser, which ranks features as well as feature interactions by
                                       different metrics
xgbmagic (0.0.3.2)                   - Data preprocessing and analysis using XGBoost
xgboost (0.6a2)                      - XGBoost Python Package
xgboostwithwarmstart (0.1.0)         - XGBoost can warm start !!!!
xmmspy (0.4)                         - boost::python wrapper for xmms_remote*
fabaff commented 7 years ago

Sure, it needs to be fixed in the origin but we need to track it down anyway.

Use the installer (like apt-get or dnf) of the operating system inside your container to install the needed packages.

jcastro commented 7 years ago

Success!

I tried installing with apt the package libboost-python-dev but I was still getting an error (not sure if the same but gattlib was not installing). Then tried with libboost-all-devand now gattlib installed correctly!

root@unBeast:/usr/src/app# pip3 install gattlib               
Collecting gattlib
  Using cached gattlib-0.20150805.tar.gz
Building wheels for collected packages: gattlib
  Running setup.py bdist_wheel for gattlib ... done
  Stored in directory: /root/.cache/pip/wheels/7d/15/79/77d35f4d5dbbf551c670ee1dc11fdb97a52c3445b8a5cbd96b
Successfully built gattlib
Installing collected packages: gattlib
Successfully installed gattlib-0.20150805