0

I've done sudo easy_install pip

Now I'm trying to install the library pyblue with sudo pip install pyblue

This is the error I'm having:

Password:
Collecting pybluez
  Downloading PyBluez-0.22.zip (109kB)
100% |████████████████████████████████| 112kB 716kB/s 
Installing collected packages: pybluez
  Running setup.py install for pybluez ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-ZBL104/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-TidHjG-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.12-intel-2.7
creating build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/__init__.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/ble.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/bluez.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/btcommon.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/msbt.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/osx.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
copying bluetooth/widcomm.py -> build/lib.macosx-10.12-intel-2.7/bluetooth
running build_ext
building 'bluetooth._osxbt' extension
creating build/temp.macosx-10.12-intel-2.7
creating build/temp.macosx-10.12-intel-2.7/osx
cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/IOBluetooth.framework/Headers -I/System/Library/Frameworks/CoreFoundation.framework/Headers -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c osx/_osxbt.c -o build/temp.macosx-10.12-intel-2.7/osx/_osxbt.o
osx/_osxbt.c:676:5: error: unknown type name 'IOBluetoothDeviceInquiryRef'; did you mean 'IOBluetoothDeviceRef'?
    IOBluetoothDeviceInquiryRef inquiry;
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    IOBluetoothDeviceRef
/System/Library/Frameworks/IOBluetooth.framework/Headers/IOBluetoothUserLib.h:34:47: note: 'IOBluetoothDeviceRef' declared here
typedef struct OpaqueIOBluetoothObjectRef *                     IOBluetoothDeviceRef;
                                                                ^
osx/_osxbt.c:688:17: error: unknown type name 'IOBluetoothDeviceInquiryRef'; did you mean 'IOBluetoothDeviceRef'?
                IOBluetoothDeviceInquiryRef inquiryRef,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                IOBluetoothDeviceRef
/System/Library/Frameworks/IOBluetooth.framework/Headers/IOBluetoothUserLib.h:34:47: note: 'IOBluetoothDeviceRef' declared here
typedef struct OpaqueIOBluetoothObjectRef *                     IOBluetoothDeviceRef;
                                                                ^
osx/_osxbt.c:703:19: warning: implicit declaration of function 'IOBluetoothDeviceInquiryCreateWithCallbackRefCon' is invalid in C99 [-Wimplicit-function-declaration]
    dd->inquiry = IOBluetoothDeviceInquiryCreateWithCallbackRefCon (&dd);
                  ^
osx/_osxbt.c:703:17: warning: incompatible integer to pointer conversion assigning to 'IOBluetoothDeviceRef' (aka 'struct OpaqueIOBluetoothObjectRef *') from 'int' [-Wint-conversion]
    dd->inquiry = IOBluetoothDeviceInquiryCreateWithCallbackRefCon (&dd);
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
osx/_osxbt.c:705:5: warning: implicit declaration of function 'IOBluetoothDeviceInquirySetCompleteCallback' is invalid in C99 [-Wimplicit-function-declaration]
    IOBluetoothDeviceInquirySetCompleteCallback (dd->inquiry,
    ^
osx/_osxbt.c:717:5: warning: implicit declaration of function 'IOBluetoothDeviceInquiryStart' is invalid in C99 [-Wimplicit-function-declaration]
    IOBluetoothDeviceInquiryStart (dd->inquiry);
    ^
osx/_osxbt.c:721:5: warning: implicit declaration of function 'IOBluetoothDeviceInquiryDelete' is invalid in C99 [-Wimplicit-function-declaration]
    IOBluetoothDeviceInquiryDelete (dd->inquiry);
    ^
5 warnings and 2 errors generated.
error: command 'cc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-ZBL104/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-TidHjG-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-ZBL104/pybluez/

Not really sure what's going on and how to fix it.

Using easy_install seemed to give a similar error.

Question:

  • Should I manually install pyblue?

Thanks

bobvader2001
  • 11
  • 1
  • 5

2 Answers2

1

Pybluez package (released 28-08-2015) you are trying to use is not supported on Apple operating systems.

From the pybluez pypi page:

Bluetooth Python extension module to allow Python ” “developers to use system Bluetooth resources. PyBluez works ” “with GNU/Linux and Windows XP.

OSX support was added sometime between that release and September 10th 2015.

At the time of writing pybluez still isn't tested with macOS (OSX 10.12), but if you did want to try and compile it by hand, you'd need the latest source from Github instead.

ffledgling
  • 11,502
  • 8
  • 47
  • 69
  • But the github page says it is – bobvader2001 Feb 07 '17 at 11:45
  • No really. It says that is **UNSTABLE**!! – Mauro Baraldi Feb 07 '17 at 11:50
  • @MauroBaraldi Please note that the pip package OP is using was released on 28th August 2015. At which point the README looked like this:- https://github.com/karulis/pybluez/blob/195a1de06475a929004c167a39fefb2de2318379/README.rst , which *does not* list OSX support. The bit about OSX support was added on 10th September 2015. Also note that macOS is 10.12, not the listed 10.10/10.11 from the README. – ffledgling Feb 07 '17 at 12:55
0

According to offical doc:

Mac OS X (Unstable - tested only on OS X 10.10/10.11):

Python 2.3 or later

Xcode

PyObjc 3.1b or later (https://pythonhosted.org/pyobjc/install.html#manual-installation)

Perhaps, this another answer could help little bit more.

You could take a look at LightBlue, that is cross-platform, but is very outdated.

Community
  • 1
  • 1
Mauro Baraldi
  • 6,346
  • 2
  • 32
  • 43