creotiv / MiBand2

Library to work with Xiaomi MiBand 2
Creative Commons Zero v1.0 Universal
544 stars 173 forks source link

Issue with Installing #9

Closed sampoder closed 4 years ago

sampoder commented 6 years ago

Hey Creotiv,

I have found an issue with your Mi Band code, when you install the requirements on a Raspberry Pi 3, it gives me the following:

Collecting bluepy (from -r requirements.txt (line 1)) Using cached https://files.pythonhosted.org/packages/85/06/0729bd5860a6658d3ddd38061caaa14914c0843cfb1305703724bd807005/bluepy-1.1.4.tar.gz Collecting pycrypto (from -r requirements.txt (line 2)) Downloading https://files.pythonhosted.org/packages/60/db/645aa9af249f059cc3a368b118de33889219e0362141e75d4eaf6f80f163/pycrypto-2.6.1.tar.gz (446kB) 100% |████████████████████████████████| 450kB 267kB/s Building wheels for collected packages: bluepy, pycrypto Running setup.py bdist_wheel for bluepy ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-SVCm50/bluepy/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/tmpl_4FDupip-wheel- --python-tag cp27: running bdist_wheel running build running build_py Working dir is /tmp/pip-build-SVCm50/bluepy 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-build-SVCm50/bluepy Return code was 2 Output was: make: Entering directory '/tmp/pip-build-SVCm50/bluepy/bluepy' tar xzf bluez-src.tgz touch ./bluez-5.29/lib/bluetooth.c ./bluez-5.29/lib/hci.c ./bluez-5.29/lib/sdp.c ./bluez-5.29/lib/uuid.c ./bluez-5.29/attrib/att.c ./bluez-5.29/attrib/gatt.c ./bluez-5.29/attrib/gattrib.c ./bluez-5.29/attrib/utils.c ./bluez-5.29/btio/btio.c ./bluez-5.29/src/log.c ./bluez-5.29/src/shared/mgmt.c ./bluez-5.29/src/shared/crypto.c ./bluez-5.29/src/shared/att.c ./bluez-5.29/src/shared/queue.c ./bluez-5.29/src/shared/util.c ./bluez-5.29/src/shared/io-glib.c ./bluez-5.29/src/shared/timeout-glib.c Package glib-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing glib-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'glib-2.0' found Package glib-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containingglib-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'glib-2.0' found gcc -L. -Os -g -Wall -DHAVE_CONFIG_H -I./bluez-5.29/attrib -I./bluez-5.29 -I./bluez-5.29/lib -I./bluez-5.29/src -I./bluez-5.29/gdbus -I./bluez-5.29/btio -o bluepy-helper bluepy-helper.c ./bluez-5.29/lib/bluetooth.c ./bluez-5.29/lib/hci.c ./bluez-5.29/lib/sdp.c ./bluez-5.29/lib/uuid.c ./bluez-5.29/attrib/att.c ./bluez-5.29/attrib/gatt.c ./bluez-5.29/attrib/gattrib.c ./bluez-5.29/attrib/utils.c ./bluez-5.29/btio/btio.c ./bluez-5.29/src/log.c ./bluez-5.29/src/shared/mgmt.c ./bluez-5.29/src/shared/crypto.c ./bluez-5.29/src/shared/att.c ./bluez-5.29/src/shared/queue.c ./bluez-5.29/src/shared/util.c ./bluez-5.29/src/shared/io-glib.c ./bluez-5.29/src/shared/timeout-glib.c bluepy-helper.c:33:18: fatal error: glib.h: No such file or directory

include

                ^

compilation terminated. ./bluez-5.29/attrib/att.c:33:18: fatal error: glib.h: No such file or directory

include

                ^

compilation terminated. ./bluez-5.29/attrib/gatt.c:32:18: fatal error: glib.h: No such file or directory

include

                ^

compilation terminated. ./bluez-5.29/attrib/gattrib.c:34:18: fatal error: glib.h: No such file or directory

include

                ^

compilation terminated. ./bluez-5.29/attrib/utils.c:30:18: fatal error: glib.h: No such file or directory

include

                ^

compilation terminated. ./bluez-5.29/btio/btio.c:37:18: fatal error: glib.h: No such file or directory

include

                ^

compilation terminated. ./bluez-5.29/src/log.c:32:18: fatal error: glib.h: No such file or directory

include

                ^

compilation terminated. ./bluez-5.29/src/shared/io-glib.c:30:18: fatal error: glib.h: No such file or directory

include

                ^

compilation terminated. ./bluez-5.29/src/shared/timeout-glib.c:22:18: fatal error: glib.h: No such file or directory

include

                ^

compilation terminated. Makefile:28: recipe for target 'bluepy-helper' failed make: *** [bluepy-helper] Error 1 make: Leaving directory '/tmp/pip-build-SVCm50/bluepy/bluepy'


Failed building wheel for bluepy Running setup.py clean for bluepy Running setup.py bdist_wheel for pycrypto ... done Stored in directory: /home/pi/.cache/pip/wheels/27/02/5e/77a69d0c16bb63c6ed32f5386f33a2809c94bd5414a2f6c196 Successfully built pycrypto Failed to build bluepy Installing collected packages: bluepy, pycrypto Running setup.py install for bluepy ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-SVCm50/bluepy/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-u2grqH-record/install-record.txt --single-version-externally-managed --compile --user --prefix=: running install running build running build_py Working dir is /tmp/pip-build-SVCm50/bluepy 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-build-SVCm50/bluepy Return code was 2 Output was: make: Entering directory '/tmp/pip-build-SVCm50/bluepy/bluepy' tar xzf bluez-src.tgz touch ./bluez-5.29/lib/bluetooth.c ./bluez-5.29/lib/hci.c ./bluez-5.29/lib/sdp.c ./bluez-5.29/lib/uuid.c ./bluez-5.29/attrib/att.c ./bluez-5.29/attrib/gatt.c ./bluez-5.29/attrib/gattrib.c ./bluez-5.29/attrib/utils.c ./bluez-5.29/btio/btio.c ./bluez-5.29/src/log.c ./bluez-5.29/src/shared/mgmt.c ./bluez-5.29/src/shared/crypto.c ./bluez-5.29/src/shared/att.c ./bluez-5.29/src/shared/queue.c ./bluez-5.29/src/shared/util.c ./bluez-5.29/src/shared/io-glib.c ./bluez-5.29/src/shared/timeout-glib.c Package glib-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing glib-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'glib-2.0' found Package glib-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containingglib-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'glib-2.0' found gcc -L. -Os -g -Wall -DHAVE_CONFIG_H -I./bluez-5.29/attrib -I./bluez-5.29 -I./bluez-5.29/lib -I./bluez-5.29/src -I./bluez-5.29/gdbus -I./bluez-5.29/btio -o bluepy-helper bluepy-helper.c ./bluez-5.29/lib/bluetooth.c ./bluez-5.29/lib/hci.c ./bluez-5.29/lib/sdp.c ./bluez-5.29/lib/uuid.c ./bluez-5.29/attrib/att.c ./bluez-5.29/attrib/gatt.c ./bluez-5.29/attrib/gattrib.c ./bluez-5.29/attrib/utils.c ./bluez-5.29/btio/btio.c ./bluez-5.29/src/log.c ./bluez-5.29/src/shared/mgmt.c ./bluez-5.29/src/shared/crypto.c ./bluez-5.29/src/shared/att.c ./bluez-5.29/src/shared/queue.c ./bluez-5.29/src/shared/util.c ./bluez-5.29/src/shared/io-glib.c ./bluez-5.29/src/shared/timeout-glib.c bluepy-helper.c:33:18: fatal error: glib.h: No such file or directory

include

                  ^
compilation terminated.
./bluez-5.29/attrib/att.c:33:18: fatal error: glib.h: No such file or directory
 #include <glib.h>
                  ^
compilation terminated.
./bluez-5.29/attrib/gatt.c:32:18: fatal error: glib.h: No such file or directory
 #include <glib.h>
                  ^
compilation terminated.
./bluez-5.29/attrib/gattrib.c:34:18: fatal error: glib.h: No such file or directory
 #include <glib.h>
                  ^
compilation terminated.
./bluez-5.29/attrib/utils.c:30:18: fatal error: glib.h: No such file or directory
 #include <glib.h>
                  ^
compilation terminated.
./bluez-5.29/btio/btio.c:37:18: fatal error: glib.h: No such file or directory
 #include <glib.h>
                  ^
compilation terminated.
./bluez-5.29/src/log.c:32:18: fatal error: glib.h: No such file or directory
 #include <glib.h>
                  ^
compilation terminated.
./bluez-5.29/src/shared/io-glib.c:30:18: fatal error: glib.h: No such file or directory
 #include <glib.h>
                  ^
compilation terminated.
./bluez-5.29/src/shared/timeout-glib.c:22:18: fatal error: glib.h: No such file or directory
 #include <glib.h>
                  ^
compilation terminated.
Makefile:28: recipe for target 'bluepy-helper' failed
make: *** [bluepy-helper] Error 1
make: Leaving directory '/tmp/pip-build-SVCm50/bluepy/bluepy'

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

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-SVCm50/bluepy/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-u2grqH-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-SVCm50/bluepy/

I am an than unable to continue the steps to use example.py. If I am doing anything could you please inform me on my mistake. -- Thanks for the hardwork, Sam

creotiv commented 6 years ago

bluepy was developed to use under linux only, so there could be problematically to use it under raspberry. Any way try to build from source like said here https://github.com/IanHarvey/bluepy#installation, there is additional manual on blueZ installation on raspbery, maybe this helps

sfantree commented 6 years ago

sudo apt install libglib2.0-dev

sharun-s commented 6 years ago

Had a similar issue on Ubuntu 18.04 had to install pkg-config (sudo apt install pkg-config) then libglib2.0-dev as above. Cool project! Thanks for putting it up.

rendhelrico commented 5 years ago

Hi! Do you have already completed the project? Can you help me how to start this? I am new to BLE .