themagpimag / magpi-issue61

2 stars 1 forks source link

sudo pip install pybluez fails #1

Open jaymesdevine opened 6 years ago

jaymesdevine commented 6 years ago

Any thoughts??

pi@pi0wUNICORN:~ $ sudo pip install pybluez Collecting pybluez Using cached PyBluez-0.22.zip Building wheels for collected packages: pybluez Running setup.py bdist_wheel for pybluez ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-7ZxlBF/pybluez/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmpwk48g8pip-wheel- --python-tag cp27: running bdist_wheel running build running build_py creating build creating build/lib.linux-armv6l-2.7 creating build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/btcommon.py -> build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/osx.py -> build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/ble.py -> build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/msbt.py -> build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/bluez.py -> build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/widcomm.py -> build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/init.py -> build/lib.linux-armv6l-2.7/bluetooth running build_ext building 'bluetooth._bluetooth' extension creating build/temp.linux-armv6l-2.7 creating build/temp.linux-armv6l-2.7/bluez arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9xgeTe/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I./port3 -I/usr/include/python2.7 -c bluez/btmodule.c -o build/temp.linux-armv6l-2.7/bluez/btmodule.o In file included from bluez/btmodule.c:20:0: bluez/btmodule.h:5:33: fatal error: bluetooth/bluetooth.h: No such file or directory

include <bluetooth/bluetooth.h>

                               ^

compilation terminated. error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1


Failed building wheel for pybluez Running setup.py clean for pybluez Failed to build pybluez Installing collected packages: pybluez Running setup.py install for pybluez ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-7ZxlBF/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-Bo2fVB-record/install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build/lib.linux-armv6l-2.7 creating build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/btcommon.py -> build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/osx.py -> build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/ble.py -> build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/msbt.py -> build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/bluez.py -> build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/widcomm.py -> build/lib.linux-armv6l-2.7/bluetooth copying bluetooth/init.py -> build/lib.linux-armv6l-2.7/bluetooth running build_ext building 'bluetooth._bluetooth' extension creating build/temp.linux-armv6l-2.7 creating build/temp.linux-armv6l-2.7/bluez arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9xgeTe/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I./port3 -I/usr/include/python2.7 -c bluez/btmodule.c -o build/temp.linux-armv6l-2.7/bluez/btmodule.o In file included from bluez/btmodule.c:20:0: bluez/btmodule.h:5:33: fatal error: bluetooth/bluetooth.h: No such file or directory

include <bluetooth/bluetooth.h>

                                 ^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-7ZxlBF/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-Bo2fVB-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-7ZxlBF/pybluez/ pi@pi0wUNICORN:~ $

Haghighatbin commented 6 years ago

I reckon you need to install python-dev or python3-dev first, give it a try.

dipen-1337lab commented 5 years ago

@jaymesdevine, @nahaangard, I too have encountered the same issue when installing PyBluez. Further as suggested, I attempted the below command.

sudo apt-get install python3-dev

However, I'm informed that python3-dev is already the newest version (3.7.3-1)

Any other thoughts?

dipen-1337lab commented 5 years ago

libbluetooth-dev was the missing library, causing the installation failure.

All's well after installing this first and, then installing PyBluez.

MrsHesse commented 5 years ago

Hi - I had the same problem even after installing python3-dev, blutooth and libbluetooth-dev.

to solve I had to install python-dev too

sudo apt-get install python-dev

mohit-yadav-cs commented 4 years ago

Hi i faced same issue Try and run sudo apt-get install bluetooth libbluetooth-dev sudo python3 -m pip install pybluez

eduanmoldeep commented 4 years ago

sudo apt-get install libbluetooth-dev worked well and enough for me, Even then for safe side, after success in PyBluez install success, I did- sudo apt-get install bluetooth

everything is sorted now

badsector998 commented 4 years ago

Hi i faced same issue Try and run sudo apt-get install bluetooth libbluetooth-dev sudo python3 -m pip install pybluez

approved on this one.. *thumbsup

ncorbuk commented 1 year ago

use_2to3 is invalid now... welp

ncorbuk commented 1 year ago

downgrade setup tools to pip3 install "setuptools<54.0.0" then install pip3 install pybluez if you get error above, then just upgrade setuptools again .. pip3 install --upgrade setuptools

use_2to3 is removed in setuptools 58+ i think