How to Install PyBlueZ on Windows 10 and Probably Windows 11

Well, this isn't the most straightforward installation, that's for sure. But if you want to be able to play with Bluetooth on Windows using Python, this is what you've got to do.

How to Install PyBlueZ on Windows 10 and Probably Windows 11
Photo by Artturi Jalli / Unsplash

This guide assumes that you already have Python 3.8+ installed; but, if not, you can install this easily from the Microsoft store. Just search for Python and look for the highest version number.

There are some rather annoying prerequisites that you need to satisfy before you can do the usual pip install PyBlueZ.

Install Prerequisites

First, you need Visual Studio Build Tools 2019. Download that from Microsoft.

During installation, there are a few options you must select:

  • Desktop Development with C++
  • Universal Windows Platform build tools

and then on the right side, be sure that you also check:

  • Windows 10 SDK
  • the latest version of MSVC C++ x64/x86 build tools

Next, you need to be sure that setuptools is installed:
open up PowerShell and run the following command

pip install --force-reinstall setuptools

Install PyBlueZ

Lastly it's time to install PyBlueZ! But if you try to use pip install pybluez it will likely still fail. This is because there are bugs in the latest pip version of PyBlueZ that have been fixed in their GitHub repository and the pip version has not yet been updated. The solution then is to clone the repo from GitHub and to use that.

Navigate your browser over to the PyBlueZ GitHub Repo and clone the repository to your computer. This can be done as simply as following the steps below.
image_2022-01-22_113047

Then open PowerShell and go to that directory and run the following:

pip install .

image_2022-01-22_113504

You Did It!

And that's it. You should now be able to import Bluetooth in your Python scripts and have fun with your wireless devices per the PyBlueZ Documentation