Bluetooth Tracker: Unable to install package pybluez

I am trying to turn on the bluetooth tracker integration but it keeps failing.

In the logs I get the following:

Unable to install package pybluez==0.22: ERROR: Command errored out with exit status 1: command: /usr/local/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-972rwxsy/pybluez/setup.py’“'”‘; file=’“'”‘/tmp/pip-install-972rwxsy/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-v99if91r cwd: /tmp/pip-install-972rwxsy/pybluez/ Complete output (19 lines): running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.9 creating build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/osx.py → build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/init.py → build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/ble.py → build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/btcommon.py → build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/widcomm.py → build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/bluez.py → build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/msbt.py → build/lib.linux-x86_64-3.9/bluetooth running build_ext building ‘bluetooth._bluetooth’ extension creating build/temp.linux-x86_64-3.9 creating build/temp.linux-x86_64-3.9/bluez gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I./port3 -I/usr/local/include/python3.9 -c bluez/btmodule.c -o build/temp.linux-x86_64-3.9/bluez/btmodule.o error: command ‘gcc’ failed: No such file or directory ---------------------------------------- ERROR: Failed building wheel for pybluez ERROR: Command errored out with exit status 1: command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '”‘"’/tmp/pip-install-972rwxsy/pybluez/setup.py’“'”‘; file=’“'”‘/tmp/pip-install-972rwxsy/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-x9jsvf9e/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/pybluez cwd: /tmp/pip-install-972rwxsy/pybluez/ Complete output (19 lines): running install running build running build_py creating build creating build/lib.linux-x86_64-3.9 creating build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/osx.py → build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/init.py → build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/ble.py → build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/btcommon.py → build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/widcomm.py → build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/bluez.py → build/lib.linux-x86_64-3.9/bluetooth copying bluetooth/msbt.py → build/lib.linux-x86_64-3.9/bluetooth running build_ext building ‘bluetooth._bluetooth’ extension creating build/temp.linux-x86_64-3.9 creating build/temp.linux-x86_64-3.9/bluez gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I./port3 -I/usr/local/include/python3.9 -c bluez/btmodule.c -o build/temp.linux-x86_64-3.9/bluez/btmodule.o error: command ‘gcc’ failed: No such file or directory ---------------------------------------- ERROR: Command errored out with exit status 1: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '”‘"’/tmp/pip-install-972rwxsy/pybluez/setup.py’“'”‘; file=’“'”‘/tmp/pip-install-972rwxsy/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-x9jsvf9e/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/pybluez Check the logs for full command output. WARNING: You are using pip version 20.2.4; however, version 21.3.1 is available. You should consider upgrading via the ‘/usr/local/bin/python3 -m pip install --upgrade pip’ command.

I’ve had the bluetooth integration running before, but using a different adaptor, so no idea why this is failing now.

I’m using Home Assistant in docker unsupervised.

The bluetooth adaptor works perfectly fine under the OS.

I’ve posted the issue on GitHub too, but hoping larger community here may-be able to assist.
I’ve had another bug I’ve reported and nothing has happened, it just gets closed from going stale.

Thanks.

pip tries to build a module with gcc, but gcc is not installed in the HA image.
IDK what triggers that behaviour, some specifics of your adaptor, I guess

thanks for the reply, wonder if HA needs to then have gcc install going forward.

Also strange too, as the BLE sensor is working perfectly fine.