Title - I can't install pybluez2:

bluetooth/linux/bluez/btmodule.c:20:10: fatal error: btmodule.h: No such file or directory      
20 | #include "btmodule.h"
   |          ^~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1

BlueZ is installed:

pi@rpi:~ $ bluetoothctl -v
bluetoothctl: 5.55

I already installed the packages libbluetooth-dev and python3-dev like it's written everywhere. Still no success. I found the missing file in this location: /usr/include/bluetooth/bluetooth.h

I'm using a RPI 3 with Raspbian GNU/Linux 11 (bullseye).

How do I install pybluez2?

  • 1
    Are you looking for python3-bluez? sudo apt install python3-bluez
    – Dougie
    Commented Oct 6, 2022 at 13:25
  • Looking at piwheels.org/project/pybluez2 it would appear that it was version 0.42 that last built successfully on RPi Bullseye. What version are you trying to install? Use pip install pybluez==0.42 to try with that version.
    – ukBaz
    Commented Oct 6, 2022 at 17:25
  • @Dougie Thanks that worked for me.
    – Standard
    Commented Oct 7, 2022 at 8:28

1 Answer 1


You need to install the Python3 version of BlueZ.

sudo apt install python3-bluez

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.