I have a PI3. I've tried installing pybluez with:

pip install pybluez


pip3 install pybluez

Both fail with:

Command /usr/bin/python3 -c "import setuptools, 
  exec(compile(getattr(tokenize, 'open', open)
  (__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
  --record /tmp/pip-sx4_w49r-record/install-record.txt
  --single-version-externally-managed --compile

failed with error code 1 in /tmp/pip-build-2yikecdn/pybluez

Storing debug log for failure in /home/pi/.pip/pip.log

I really need to use pybluez. Can anyone help me out?

Thanks a million!

  • What does the log say?
    – Bex
    Commented Aug 17, 2017 at 9:05
  • What does sudo pip3 install pybluez do? What's in /home/pi/.pip/pip.log?
    – Dougie
    Commented Feb 6, 2020 at 13:27

1 Answer 1


Finally found an answer to the issue. Need to do the following to get pybluez installed on Raspberry Pi 3

sudo apt-get install libbluetooth-dev
sudo apt-get install python-dev
sudo pip install PyBluez

The first two install the appropriate header files that are missing.

  • 4
    Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Commented Feb 6, 2020 at 22:40

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.