ThomDietrich / miflora-mqtt-daemon

Linux service to collect and transfer Xiaomi Mi Flora plant sensor data via MQTT to your smart home system, with cluster support 🌱🌼🥀🏡🌳
MIT License
606 stars 141 forks source link

Installation fails #153

Closed Werner-G closed 1 year ago

Werner-G commented 2 years ago

I made a fresh installation on my RPi4 with 64bit Bullseye. So, Mosquitto, NodeRed and Zigbee2mqtt are really updated. I hope this daemon is exactly what I am looking for to read out miflora (and maybe other BLE-sensors, too)... but I cannot install:

sudo pip3 install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting miflora==0.7.1
  Downloading https://www.piwheels.org/simple/miflora/miflora-0.7.1-py3-none-any                                                                .whl (23 kB)
Collecting bluepy==1.3.0
  Downloading bluepy-1.3.0.tar.gz (217 kB)
     |████████████████████████████████| 217 kB 2.7 MB/s
Collecting btlewrap==0.0.10
  Downloading https://www.piwheels.org/simple/btlewrap/btlewrap-0.0.10-py3-none-                                                                any.whl (19 kB)
Collecting paho-mqtt==1.4.0
  Downloading https://www.piwheels.org/simple/paho-mqtt/paho_mqtt-1.4.0-py3-none                                                                -any.whl (48 kB)
     |████████████████████████████████| 48 kB 1.1 MB/s
Collecting wheel==0.29.0
  Downloading https://www.piwheels.org/simple/wheel/wheel-0.29.0-py2.py3-none-an                                                                y.whl (66 kB)
     |████████████████████████████████| 66 kB 900 kB/s
Collecting sdnotify==0.3.1
  Downloading https://www.piwheels.org/simple/sdnotify/sdnotify-0.3.1-py3-none-a                                                                ny.whl (4.3 kB)
Collecting colorama==0.3.9
  Downloading https://www.piwheels.org/simple/colorama/colorama-0.3.9-py2.py3-no                                                                ne-any.whl (20 kB)
Collecting Unidecode==0.4.21
  Downloading https://www.piwheels.org/simple/unidecode/Unidecode-0.04.21-py2.py                                                                3-none-any.whl (228 kB)
     |████████████████████████████████| 228 kB 3.3 MB/s
Building wheels for collected packages: bluepy
  Building wheel for bluepy (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0                                                                ] = '"'"'/tmp/pip-install-v5kd4we3/bluepy_12e6272774d84703aedf0f2715964ef9/setup                                                                .py'"'"'; __file__='"'"'/tmp/pip-install-v5kd4we3/bluepy_12e6272774d84703aedf0f2                                                                715964ef9/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code                                                                =f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __f                                                                ile__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-ah5c0qzd
       cwd: /tmp/pip-install-v5kd4we3/bluepy_12e6272774d84703aedf0f2715964ef9/
  Complete output (11 lines):
  running bdist_wheel
  running build
  running build_py
  Working dir is /tmp/pip-install-v5kd4we3/bluepy_12e6272774d84703aedf0f2715964e                                                                f9
  execute make -C ./bluepy clean
  execute make -C bluepy -j1
  Failed to compile bluepy-helper. Exiting install.
  Command was 'make -C bluepy -j1' in /tmp/pip-install-v5kd4we3/bluepy_12e627277                                                                4d84703aedf0f2715964ef9
  Return code was 2
  Output was:
  b"make: Entering directory '/tmp/pip-install-v5kd4we3/bluepy_12e6272774d84703a                                                                edf0f2715964ef9/bluepy'\ntar xzf bluez-src.tgz\ntouch ./bluez-5.47/lib/bluetooth                                                                .c ./bluez-5.47/lib/hci.c ./bluez-5.47/lib/sdp.c ./bluez-5.47/lib/uuid.c ./bluez                                                                -5.47/attrib/att.c ./bluez-5.47/attrib/gatt.c ./bluez-5.47/attrib/gattrib.c ./bl                                                                uez-5.47/attrib/utils.c ./bluez-5.47/btio/btio.c ./bluez-5.47/src/log.c ./bluez-                                                                5.47/src/shared/mgmt.c ./bluez-5.47/src/shared/crypto.c ./bluez-5.47/src/shared/                                                                att.c ./bluez-5.47/src/shared/queue.c ./bluez-5.47/src/shared/util.c ./bluez-5.4                                                                7/src/shared/io-glib.c ./bluez-5.47/src/shared/timeout-glib.c\nPackage glib-2.0                                                                 was not found in the pkg-config search path.\nPerhaps you should add the directo                                                                ry containing `glib-2.0.pc'\nto the PKG_CONFIG_PATH environment variable\nNo pac                                                                kage 'glib-2.0' found\nPackage glib-2.0 was not found in the pkg-config search p                                                                ath.\nPerhaps you should add the directory containing `glib-2.0.pc'\nto the PKG_                                                                CONFIG_PATH environment variable\nNo package 'glib-2.0' found\ncc -L. -g -Wall                                                                  -Os -DHAVE_CONFIG_H -I./bluez-5.47/attrib -I./bluez-5.47 -I./bluez-5.47/lib -I./                                                                bluez-5.47/src -I./bluez-5.47/gdbus -I./bluez-5.47/btio -I./bluez-5.47/sys  -o b                                                                luepy-helper bluepy-helper.c ./bluez-5.47/lib/bluetooth.c ./bluez-5.47/lib/hci.c                                                                 ./bluez-5.47/lib/sdp.c ./bluez-5.47/lib/uuid.c ./bluez-5.47/attrib/att.c ./blue                                                                z-5.47/attrib/gatt.c ./bluez-5.47/attrib/gattrib.c ./bluez-5.47/attrib/utils.c .                                                                /bluez-5.47/btio/btio.c ./bluez-5.47/src/log.c ./bluez-5.47/src/shared/mgmt.c ./                                                                bluez-5.47/src/shared/crypto.c ./bluez-5.47/src/shared/att.c ./bluez-5.47/src/sh                                                                ared/queue.c ./bluez-5.47/src/shared/util.c ./bluez-5.47/src/shared/io-glib.c ./                                                                bluez-5.47/src/shared/timeout-glib.c \nbluepy-helper.c:33:10: fatal error: glib.                                                                h: No such file or directory\n   33 | #include <glib.h>\n      |          ^~~~~~                                                                ~~\ncompilation terminated.\n./bluez-5.47/attrib/att.c:33:10: fatal error: glib.                                                                h: No such file or directory\n   33 | #include <glib.h>\n      |          ^~~~~~                                                                ~~\ncompilation terminated.\n./bluez-5.47/attrib/gatt.c:32:10: fatal error: glib                                                                .h: No such file or directory\n   32 | #include <glib.h>\n      |          ^~~~~                                                                ~~~\ncompilation terminated.\n./bluez-5.47/attrib/gattrib.c:34:10: fatal error:                                                                 glib.h: No such file or directory\n   34 | #include <glib.h>\n      |          ^                                                                ~~~~~~~\ncompilation terminated.\n./bluez-5.47/attrib/utils.c:30:10: fatal error                                                                : glib.h: No such file or directory\n   30 | #include <glib.h>\n      |                                                                          ^~~~~~~~\ncompilation terminated.\n./bluez-5.47/btio/btio.c:37:10: fatal error:                                                                 glib.h: No such file or directory\n   37 | #include <glib.h>\n      |                                                                          ^~~~~~~~\ncompilation terminated.\n./bluez-5.47/src/log.c:38:10: fatal error: gl                                                                ib.h: No such file or directory\n   38 | #include <glib.h>\n      |          ^~~                                                                ~~~~~\ncompilation terminated.\n./bluez-5.47/src/shared/io-glib.c:30:10: fatal e                                                                rror: glib.h: No such file or directory\n   30 | #include <glib.h>\n      |                                                                          ^~~~~~~~\ncompilation terminated.\n./bluez-5.47/src/shared/timeout-glib.c:2                                                                2:10: fatal error: glib.h: No such file or directory\n   22 | #include <glib.h>\                                                                n      |          ^~~~~~~~\ncompilation terminated.\nmake: *** [Makefile:30: blu                                                                epy-helper] Error 1\nmake: Leaving directory '/tmp/pip-install-v5kd4we3/bluepy_1                                                                2e6272774d84703aedf0f2715964ef9/bluepy'\n"
  ----------------------------------------
  ERROR: Failed building wheel for bluepy
  Running setup.py clean for bluepy
Failed to build bluepy
Installing collected packages: btlewrap, wheel, Unidecode, sdnotify, paho-mqtt,                                                                 miflora, colorama, bluepy
  Attempting uninstall: wheel
    Found existing installation: wheel 0.34.2
    Not uninstalling wheel at /usr/lib/python3/dist-packages, outside environmen                                                                t /usr
    Can't uninstall 'wheel'. No files were found to uninstall.
    Running setup.py install for bluepy ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv                                                                [0] = '"'"'/tmp/pip-install-v5kd4we3/bluepy_12e6272774d84703aedf0f2715964ef9/set                                                                up.py'"'"'; __file__='"'"'/tmp/pip-install-v5kd4we3/bluepy_12e6272774d84703aedf0                                                                f2715964ef9/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);co                                                                de=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, _                                                                _file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-59ciryh_/install-rec                                                                ord.txt --single-version-externally-managed --compile --install-headers /usr/loc                                                                al/include/python3.9/bluepy
         cwd: /tmp/pip-install-v5kd4we3/bluepy_12e6272774d84703aedf0f2715964ef9/
    Complete output (11 lines):
    running install
    running build
    running build_py
    Working dir is /tmp/pip-install-v5kd4we3/bluepy_12e6272774d84703aedf0f271596                                                                4ef9
    execute make -C ./bluepy clean
    execute make -C bluepy -j1
    Failed to compile bluepy-helper. Exiting install.
    Command was 'make -C bluepy -j1' in /tmp/pip-install-v5kd4we3/bluepy_12e6272                                                                774d84703aedf0f2715964ef9
    Return code was 2
    Output was:
    b"make: Entering directory '/tmp/pip-install-v5kd4we3/bluepy_12e6272774d8470                                                                3aedf0f2715964ef9/bluepy'\ntar xzf bluez-src.tgz\ntouch ./bluez-5.47/lib/bluetoo                                                                th.c ./bluez-5.47/lib/hci.c ./bluez-5.47/lib/sdp.c ./bluez-5.47/lib/uuid.c ./blu                                                                ez-5.47/attrib/att.c ./bluez-5.47/attrib/gatt.c ./bluez-5.47/attrib/gattrib.c ./                                                                bluez-5.47/attrib/utils.c ./bluez-5.47/btio/btio.c ./bluez-5.47/src/log.c ./blue                                                                z-5.47/src/shared/mgmt.c ./bluez-5.47/src/shared/crypto.c ./bluez-5.47/src/share                                                                d/att.c ./bluez-5.47/src/shared/queue.c ./bluez-5.47/src/shared/util.c ./bluez-5                                                                .47/src/shared/io-glib.c ./bluez-5.47/src/shared/timeout-glib.c\nPackage glib-2.                                                                0 was not found in the pkg-config search path.\nPerhaps you should add the direc                                                                tory containing `glib-2.0.pc'\nto the PKG_CONFIG_PATH environment variable\nNo p                                                                ackage 'glib-2.0' found\nPackage glib-2.0 was not found in the pkg-config search                                                                 path.\nPerhaps you should add the directory containing `glib-2.0.pc'\nto the PK                                                                G_CONFIG_PATH environment variable\nNo package 'glib-2.0' found\ncc -L. -g -Wall                                                                  -Os -DHAVE_CONFIG_H -I./bluez-5.47/attrib -I./bluez-5.47 -I./bluez-5.47/lib -I                                                                ./bluez-5.47/src -I./bluez-5.47/gdbus -I./bluez-5.47/btio -I./bluez-5.47/sys  -o                                                                 bluepy-helper bluepy-helper.c ./bluez-5.47/lib/bluetooth.c ./bluez-5.47/lib/hci                                                                .c ./bluez-5.47/lib/sdp.c ./bluez-5.47/lib/uuid.c ./bluez-5.47/attrib/att.c ./bl                                                                uez-5.47/attrib/gatt.c ./bluez-5.47/attrib/gattrib.c ./bluez-5.47/attrib/utils.c                                                                 ./bluez-5.47/btio/btio.c ./bluez-5.47/src/log.c ./bluez-5.47/src/shared/mgmt.c                                                                 ./bluez-5.47/src/shared/crypto.c ./bluez-5.47/src/shared/att.c ./bluez-5.47/src/                                                                shared/queue.c ./bluez-5.47/src/shared/util.c ./bluez-5.47/src/shared/io-glib.c                                                                 ./bluez-5.47/src/shared/timeout-glib.c \nbluepy-helper.c:33:10: fatal error: gli                                                                b.h: No such file or directory\n   33 | #include <glib.h>\n      |          ^~~~                                                                ~~~~\ncompilation terminated.\n./bluez-5.47/attrib/att.c:33:10: fatal error: gli                                                                b.h: No such file or directory\n   33 | #include <glib.h>\n      |          ^~~~                                                                ~~~~\ncompilation terminated.\n./bluez-5.47/attrib/gatt.c:32:10: fatal error: gl                                                                ib.h: No such file or directory\n   32 | #include <glib.h>\n      |          ^~~                                                                ~~~~~\ncompilation terminated.\n./bluez-5.47/attrib/gattrib.c:34:10: fatal error                                                                : glib.h: No such file or directory\n   34 | #include <glib.h>\n      |                                                                          ^~~~~~~~\ncompilation terminated.\n./bluez-5.47/attrib/utils.c:30:10: fatal err                                                                or: glib.h: No such file or directory\n   30 | #include <glib.h>\n      |                                                                          ^~~~~~~~\ncompilation terminated.\n./bluez-5.47/btio/btio.c:37:10: fatal erro                                                                r: glib.h: No such file or directory\n   37 | #include <glib.h>\n      |                                                                          ^~~~~~~~\ncompilation terminated.\n./bluez-5.47/src/log.c:38:10: fatal error:                                                                 glib.h: No such file or directory\n   38 | #include <glib.h>\n      |          ^                                                                ~~~~~~~\ncompilation terminated.\n./bluez-5.47/src/shared/io-glib.c:30:10: fatal                                                                 error: glib.h: No such file or directory\n   30 | #include <glib.h>\n      |                                                                          ^~~~~~~~\ncompilation terminated.\n./bluez-5.47/src/shared/timeout-glib.c                                                                :22:10: fatal error: glib.h: No such file or directory\n   22 | #include <glib.h                                                                >\n      |          ^~~~~~~~\ncompilation terminated.\nmake: *** [Makefile:30: b                                                                luepy-helper] Error 1\nmake: Leaving directory '/tmp/pip-install-v5kd4we3/bluepy                                                                _12e6272774d84703aedf0f2715964ef9/bluepy'\n"
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sy                                                                s, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-v5kd4we3/bluepy_12e                                                                6272774d84703aedf0f2715964ef9/setup.py'"'"'; __file__='"'"'/tmp/pip-install-v5kd                                                                4we3/bluepy_12e6272774d84703aedf0f2715964ef9/setup.py'"'"';f=getattr(tokenize, '                                                                "'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"                                                                ');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tm                                                                p/pip-record-59ciryh_/install-record.txt --single-version-externally-managed --c                                                                ompile --install-headers /usr/local/include/python3.9/bluepy Check the logs for                                                                 full command output.
ThomDietrich commented 2 years ago

Hey! Seems like this is an issue with bluepy. Maybe linked to the latest raspbian or the 64bit version. Does sudo pip3 install bluepy succeed?

Werner-G commented 2 years ago

cool, superschnell...

No, even this doesn't work. As an extract: pi@MyHome:~ $ sudo pip3 install bluepy Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting bluepy Using cached bluepy-1.3.0.tar.gz (217 kB) Building wheels for collected packages: bluepy Building wheel for bluepy (setup.py) ... error

and

Running setup.py clean for bluepy Failed to build bluepy Installing collected packages: bluepy Running setup.py install for bluepy ... error

npm v6.14.16 node 14.19.1

Do you need a complete log?

batje commented 2 years ago

I had the same error, with a bit more detail:

b"make: Entering directory '/tmp/pip-install-awh6wojw/bluepy/bluepy'\ntar xzf bluez-src.tgz\ntouch ./bluez-5.47/lib/bluetooth.c ./bluez-5.47/lib/hci.c ./bluez-5.47/lib/sdp.c ./bluez-5.47/lib/uuid.c ./bluez-5.47/attrib/att.c ./bluez-5.47/attrib/gatt.c ./bluez-5.47/attrib/gattrib.c ./bluez-5.47/attrib/utils.c ./bluez-5.47/btio/btio.c ./bluez-5.47/src/log.c ./bluez-5.47/src/shared/mgmt.c ./bluez-5.47/src/shared/crypto.c ./bluez-5.47/src/shared/att.c ./bluez-5.47/src/shared/queue.c ./bluez-5.47/src/shared/util.c ./bluez-5.47/src/shared/io-glib.c ./bluez-5.47/src/shared/timeout-glib.c\nPackage glib-2.0 was not found in the pkg-config search path.\nPerhaps you should add the directory containing glib-2.0.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'glib-2.0' found\nPackage glib-2.0 was not found in the pkg-config search path.\nPerhaps you should add the directory containingglib-2.0.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'glib-2.0' found\ncc -L. -g -Wall -Os -DHAVE_CONFIG_H -I./bluez-5.47/attrib -I./bluez-5.47 -I./bluez-5.47/lib -I./bluez-5.47/src -I./bluez-5.47/gdbus -I./bluez-5.47/btio -I./bluez-5.47/sys -o bluepy-helper bluepy-helper.c ./bluez-5.47/lib/bluetooth.c ./bluez-5.47/lib/hci.c ./bluez-5.47/lib/sdp.c ./bluez-5.47/lib/uuid.c ./bluez-5.47/attrib/att.c ./bluez-5.47/attrib/gatt.c ./bluez-5.47/attrib/gattrib.c ./bluez-5.47/attrib/utils.c ./bluez-5.47/btio/btio.c ./bluez-5.47/src/log.c ./bluez-5.47/src/shared/mgmt.c ./bluez-5.47/src/shared/crypto.c ./bluez-5.47/src/shared/att.c ./bluez-5.47/src/shared/queue.c ./bluez-5.47/src/shared/util.c ./bluez-5.47/src/shared/io-glib.c ./bluez-5.47/src/shared/timeout-glib.c \nbluepy-helper.c:33:10: fatal error: glib.h: No such file or directory\n #include \n ^~\ncompilation terminated.\n./bluez-5.47/attrib/att.c:33:10: fatal error: glib.h: No such file or directory\n #include \n ^~\ncompilation terminated.\n./bluez-5.47/attrib/gatt.c:32:10: fatal error: glib.h: No such file or directory\n #include \n ^~\ncompilation terminated.\n./bluez-5.47/attrib/gattrib.c:34:10: fatal error: glib.h: No such file or directory\n #include \n ^~\ncompilation terminated.\n./bluez-5.47/attrib/utils.c:30:10: fatal error: glib.h: No such file or directory\n #include \n ^~\ncompilation terminated.\n./bluez-5.47/btio/btio.c:37:10: fatal error: glib.h: No such file or directory\n #include \n ^~\ncompilation terminated.\n./bluez-5.47/src/log.c:38:10: fatal error: glib.h: No such file or directory\n #include \n ^~\ncompilation terminated.\n./bluez-5.47/src/shared/io-glib.c:30:10: fatal error: glib.h: No such file or directory\n #include \n ^~\ncompilation terminated.\n./bluez-5.47/src/shared/timeout-glib.c:22:10: fatal error: glib.h: No such file or directory\n #include \n ^~~~\ncompilation terminated.\nmake: *** [Makefile:30: bluepy-helper] Error 1\nmake: Leaving directory '/tmp/pip-install-awh6wojw/bluepy/bluepy'\n"

Which translates to

fatal error: glib.h: No such file or directory

Which let me to here

Where they advise to try:

sudo apt-get install libglib2.0-dev 

Which solved the problem on my raspberry Pi

McMacaron commented 2 years ago

I am using rapsberian64 and in order to make it run I had to run this:

$ sudo apt-get install python3-pip libglib2.0-dev $ sudo pip3 install bluepy

ThomDietrich commented 1 year ago

Hey guys, in summary, what should be added to the README? PR welcome!!

devMaFi commented 1 year ago

As I faced the same issue, I suggest to added the following to the README, as by now this is not yet included:


In case you are running the service on an Raspberry Pi4 64 bit version, the following package is required too sudo apt install libglib2.0-dev


Best Martin

devMaFi commented 1 year ago

PR https://github.com/ThomDietrich/miflora-mqtt-daemon/pull/170

ThomDietrich commented 1 year ago

Thanks!