Skip to content

error: command '/usr/bin/gcc' failed with exit code 1 #85

@meetdilip

Description

@meetdilip

Thanks for the helpful library. Appreciate the hard work.

My Blaupunkt SBA 20 shows battery percentage in Windows 10 but not in Ubuntu 22.04

I tried everything to fix the Device or Resource busy

#77 (comment)

including using bluetoothctl and GUI to disconnect and connect my Blaupunkt SBA 20 before running the script. Then changed setuptools == 58

#83

And then tried the command to install pybluez as in

#78

but I get this error

dilip@dilip-pc:~$ pip install PyBluez
Defaulting to user installation because normal site-packages is not writeable
Collecting PyBluez
  Using cached PyBluez-0.23.tar.gz (97 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: PyBluez
  Building wheel for PyBluez (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      /snap/blender/2661/3.2/python/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'use_2to3'
        warnings.warn(msg)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.10
      creating build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/macos.py -> build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/msbt.py -> build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/__init__.py -> build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/widcomm.py -> build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/btcommon.py -> build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/bluez.py -> build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/ble.py -> build/lib.linux-x86_64-3.10/bluetooth
      running build_ext
      building 'bluetooth._bluetooth' extension
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/bluez
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/home/sybren/buildbot-builder/linux_glibc217_x86_64_cmake/build_deps/deps/Release/sqlite/include -I/home/sybren/buildbot-builder/linux_glibc217_x86_64_cmake/build_deps/deps/Release/bzip2/include -I/home/sybren/buildbot-builder/linux_glibc217_x86_64_cmake/build_deps/deps/Release/lzma/include -I/home/sybren/buildbot-builder/linux_glibc217_x86_64_cmake/build_deps/deps/Release/zlib/include -fPIC -fPIC -fPIC -I./port3 -I/snap/blender/2661/3.2/python/include/python3.10 -c bluez/btmodule.c -o build/temp.linux-x86_64-3.10/bluez/btmodule.o
      In file included from bluez/btmodule.c:20:
      bluez/btmodule.h:4:10: fatal error: Python.h: No such file or directory
          4 | #include "Python.h"
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: 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
  error: subprocess-exited-with-error
  
  × Running setup.py install for PyBluez did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      /snap/blender/2661/3.2/python/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'use_2to3'
        warnings.warn(msg)
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.10
      creating build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/macos.py -> build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/msbt.py -> build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/__init__.py -> build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/widcomm.py -> build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/btcommon.py -> build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/bluez.py -> build/lib.linux-x86_64-3.10/bluetooth
      copying bluetooth/ble.py -> build/lib.linux-x86_64-3.10/bluetooth
      running build_ext
      building 'bluetooth._bluetooth' extension
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/bluez
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/home/sybren/buildbot-builder/linux_glibc217_x86_64_cmake/build_deps/deps/Release/sqlite/include -I/home/sybren/buildbot-builder/linux_glibc217_x86_64_cmake/build_deps/deps/Release/bzip2/include -I/home/sybren/buildbot-builder/linux_glibc217_x86_64_cmake/build_deps/deps/Release/lzma/include -I/home/sybren/buildbot-builder/linux_glibc217_x86_64_cmake/build_deps/deps/Release/zlib/include -fPIC -fPIC -fPIC -I./port3 -I/snap/blender/2661/3.2/python/include/python3.10 -c bluez/btmodule.c -o build/temp.linux-x86_64-3.10/bluez/btmodule.o
      In file included from bluez/btmodule.c:20:
      bluez/btmodule.h:4:10: fatal error: Python.h: No such file or directory
          4 | #include "Python.h"
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> PyBluez

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions