I am stuck trying to figure this one out…
System:
NUC5 running Ubuntu 18.04 LTS
Docker CE running Hass.io + addons
Bluetooth works in the host system (Ubuntu):
-
hcitool dev
lists thehci0
and mac address -
hcitool scan
finds my mobile phone
Hass.io logs:
Mon Jul 15 2019 22:14:18 GMT+0100 (British Summer Time)
Unable to install package pybluez==0.22: ERROR: Complete output from command /usr/local/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ybplna0e/PyBluez/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/pip-wheel-0ibqdqyc --python-tag cp37:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/btcommon.py -> build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/widcomm.py -> build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/__init__.py -> build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/bluez.py -> build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/osx.py -> build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/msbt.py -> build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/ble.py -> build/lib.linux-x86_64-3.7/bluetooth
running build_ext
building 'bluetooth._bluetooth' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/bluez
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I./port3 -I/usr/local/include/python3.7m -c bluez/btmodule.c -o build/temp.linux-x86_64-3.7/bluez/btmodule.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for PyBluez
ERROR: Complete output from command /usr/local/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ybplna0e/PyBluez/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-record-yyhksh65/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/btcommon.py -> build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/widcomm.py -> build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/__init__.py -> build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/bluez.py -> build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/osx.py -> build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/msbt.py -> build/lib.linux-x86_64-3.7/bluetooth
copying bluetooth/ble.py -> build/lib.linux-x86_64-3.7/bluetooth
running build_ext
building 'bluetooth._bluetooth' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/bluez
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I./port3 -I/usr/local/include/python3.7m -c bluez/btmodule.c -o build/temp.linux-x86_64-3.7/bluez/btmodule.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/usr/local/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ybplna0e/PyBluez/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-record-yyhksh65/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-ybplna0e/PyBluez/
From the logs it looks like gcc is “missing”. I have attempted to fix this by adding it via:
apk add build-base python-dev
withn the homeassistant container, but then it can’t build it and errors on bluetooth/bluetooth.h, which I believe is related to missing libbluetooth-dev
package, so I think I now need to add bluez-dev
, https://pkgs.alpinelinux.org/contents?branch=edge&name=bluez-dev&arch=x86_64&repo=main
I am just wondering if this is the right direction and why do I need those extra steps…
Is this something to do with the NUC by any chance?
EDIT:
That did it:
apk add build-base python-dev bluez-dev
pip install pybluez
Restart the container and it works!
Also removed python-dev and build-base