Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to build PyBluez #30

Closed
chaoscreater opened this issue Jul 31, 2020 · 6 comments
Closed

Failed to build PyBluez #30

chaoscreater opened this issue Jul 31, 2020 · 6 comments

Comments

@chaoscreater
Copy link

I'm not a programmer and know nothing about Python. Could someone please take a look at this message and let me know what I'm missing? I'm using Python 3.7.2 and I ran pip3 install bluetooth_battery and I got this message:

Successfully built bluetooth-battery
Failed to build PyBluez
DEPRECATION: Could not build wheels for PyBluez which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: PyBluez, bluetooth-battery
    Running setup.py install for PyBluez ... error
...
...
...
@TheWeirdDev
Copy link
Owner

Please provide the full error message

@chaoscreater
Copy link
Author

OK, after a bit of Google and some trial and errors, I've managed to fix this by doing this:

git clone https://github.com/pybluez/pybluez
cd pybluez
python setup.py install

I've also had to download VC++ 14.0 and download the VCBuild (which installs about 4GBs worth of data). None of this is included in the requirements...

I've managed to install by doing this:

pip3 install bluetooth_battery

But now I'm getting a new error message and this is the full error message:

Installing collected packages: bluetooth-battery
Successfully installed bluetooth-battery-1.1.0
PS C:\Users\Ricky\pybluez> bluetooth_battery [cc:98:8b:56:8c:ad]
Traceback (most recent call last):
  File "c:\users\ricky\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\ricky\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Ricky\AppData\Local\Programs\Python\Python37-32\Scripts\bluetooth_battery.exe\__main__.py", line 4, in <module>
  File "c:\users\ricky\appdata\local\programs\python\python37-32\lib\site-packages\bluetooth_battery\bluetooth_battery.py", line 12, in <module>
    import bluetooth
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "c:\users\ricky\appdata\local\programs\python\python37-32\lib\site-packages\pybluez-0.30-py3.7-win32.egg\bluetooth\__init__.py", line 33, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "c:\users\ricky\appdata\local\programs\python\python37-32\lib\site-packages\pybluez-0.30-py3.7-win32.egg\bluetooth\msbt.py", line 4, in <module>
AttributeError: module 'bluetooth._msbt' has no attribute 'initwinsock'

wtong98 added a commit to wtong98/Bluetooth_Headset_Battery_Level that referenced this issue Aug 1, 2020
I suspect TheWeirdDev#30 stems from this missing dependency.
@TheWeirdDev
Copy link
Owner

TheWeirdDev commented Aug 1, 2020

Rerun the script without the brackets around mac address.

I didn't know you need to install VC++ since this project only aims to support GNU/Linux systems as Windows already has this feature integrated in its Bluetooth settings.

For the error message you got, this might help: pybluez/pybluez#180 (comment)

@chaoscreater
Copy link
Author

Thanks, got it working now. Issue was that I included the brackets for the MAC address. Can close this now.

@benshep
Copy link

benshep commented Mar 19, 2021

@chaoscreater - is it possible to share your compiled PyBluez for Windows?

@chaoscreater
Copy link
Author

@chaoscreater - is it possible to share your compiled PyBluez for Windows?

I simply installed it as per the instructions in this Github project. I think I ran into a few errors and had to Google them. But whatever that gets installed in the background, they go into the Python installation folder and then into the subfolders. I don't even know which subfolders the files go into.

I'm not familiar with Python at all, so I don't even know how to share this with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants