hbldh / pymetawear

Community developed SDK around the Python bindings for the C++ SDK

Home Page:https://hbldh.github.io/pymetawear/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No matching distribution found for gattlib==0.20171002 (from metawear)

onshoremanover opened this issue · comments

Noob here. I run on raspbian-stretch-lite... on a raspberrypi zero w

I have installed all the dependencies for gattlib and as you can see, gattlib version 0.20171002 was successfully installed.

These are the commands I typed in the terminal.

$ pip install git+https://github.com/mbientlab/pygattlib.git@master#egg=gattlib
$ pip install metawear

  • Successfully installed gattlib-0.20171002
  • pi@raspberrypi:~ $ pip install metawear
  • Collecting metawear
  • Collecting gattlib==0.20171002 (from metawear)
  • Could not find a version that satisfies the requirement gattlib==0.20171002 (from metawear) (from versions: 0.20150119.linux-x86_64, 0.20150119, 0.20150130, 0.20150131, 0.20150805) No matching distribution found for gattlib==0.20171002 (from metawear)

What did I do wrong?

I also tried $ pip install metawear --process-dependency-links and it gave the same error message

Trying to reproduce. I haven't got a Pi Zero to try on, and my Pi 2 is running Stretch, not Stretch lite.

Conclusion: I cannot reproduce the problem on a Raspberry 2 on Rasbian Strech. I will borrow a Pi Zero W from a friend and try it over the weekend.
It is strange problem, which I believe is not due to neither the metawear or the pymetawear package.

OS setup:

pi@hbldh-pi2:~ $ uname -a
Linux hbldh-pi2 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux
pi@hbldh-pi2:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Install prerequisites:

pi@hbldh-pi2:~ $ sudo apt install pkg-config python3-dev libboost-python-dev libboost-thread-dev libglib2.0-dev 

Creating and activating virtual enviroment:

pi@hbldh-pi2:~ $ python3 --version
Python 3.5.3
pi@hbldh-pi2:~ $ python3 -m venv testenv
pi@hbldh-pi2:~ $ source testenv/bin/activate

Install gattlib:

(testenv) pi@hbldh-pi2:~ $ pip install git+https://github.com/mbientlab/pygattlib.git@master#egg=gattlib
Collecting gattlib from git+https://github.com/mbientlab/pygattlib.git@master#egg=gattlib
  Cloning https://github.com/mbientlab/pygattlib.git (to master) to /tmp/pip-build-ox7c1wxs/gattlib
Installing collected packages: gattlib
  Running setup.py install for gattlib ... done
Successfully installed gattlib-0.20171002

Install metawear:

(testenv) pi@hbldh-pi2:~ $ pip install metawear
Collecting metawear
  Downloading https://www.piwheels.hostedpi.com/simple/metawear/metawear-0.3.1-py3-none-any.whl (646kB)
    100% |████████████████████████████████| 655kB 188kB/s
Requirement already satisfied: gattlib==0.20171002 in ./testenv/lib/python3.5/site-packages (from metawear)
Collecting requests (from metawear)
  Downloading https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl (88kB)
    100% |████████████████████████████████| 92kB 362kB/s
Collecting urllib3<1.23,>=1.21.1 (from requests->metawear)
  Downloading https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl (132kB)
    100% |████████████████████████████████| 133kB 952kB/s
Collecting idna<2.7,>=2.5 (from requests->metawear)
  Downloading https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 438kB/s
Collecting chardet<3.1.0,>=3.0.2 (from requests->metawear)
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 367kB/s
Collecting certifi>=2017.4.17 (from requests->metawear)
  Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
    100% |████████████████████████████████| 153kB 388kB/s
Installing collected packages: urllib3, idna, chardet, certifi, requests, metawear
Successfully installed certifi-2018.4.16 chardet-3.0.4 idna-2.6 metawear-0.3.1 requests-2.18.4 urllib3-1.22

Install pymetawear:

(testenv) pi@hbldh-pi2:~ $ pip install pymetawear
Collecting pymetawear
  Downloading https://files.pythonhosted.org/packages/41/3a/eee643c1923643143591dd52127f9d5fecd42283037968a5b2c47861e0a5/pymetawear-0.9.1-py2.py3-none-any.whl
Requirement already satisfied: metawear>=0.3.1 in ./testenv/lib/python3.5/site-packages (from pymetawear)
Requirement already satisfied: gattlib==0.20171002 in ./testenv/lib/python3.5/site-packages (from metawear>=0.3.1->pymetawear)
Requirement already satisfied: requests in ./testenv/lib/python3.5/site-packages (from metawear>=0.3.1->pymetawear)
Requirement already satisfied: certifi>=2017.4.17 in ./testenv/lib/python3.5/site-packages (from requests->metawear>=0.3.1->pymetawear)
Requirement already satisfied: idna<2.7,>=2.5 in ./testenv/lib/python3.5/site-packages (from requests->metawear>=0.3.1->pymetawear)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in ./testenv/lib/python3.5/site-packages (from requests->metawear>=0.3.1->pymetawear)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./testenv/lib/python3.5/site-packages (from requests->metawear>=0.3.1->pymetawear)
Installing collected packages: pymetawear
Successfully installed pymetawear-0.9.1

Really strange

I now tried it with a Raspberry Pi 3 from another team, IT WORKED!!

pi@w004-desys-24:~$ uname -a
Linux w004-desys-24 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU/Linux
pi@w004-desys-24:~$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@w004-desys-24:~$ sudo apt install pkg-config python3-dev libboost-python-dev libboost-thread-dev libglib2.0-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libboost-python-dev is already the newest version (1.62.0.1+b4).
libboost-thread-dev is already the newest version (1.62.0.1+b4).
libglib2.0-dev is already the newest version (2.50.3-2).
pkg-config is already the newest version (0.29-4).
python3-dev is already the newest version (3.5.3-1).
python3-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
pi@w004-desys-24:~$ python3 --version
Python 3.5.3

I now try it on my Zero W

Tried it on a Raspberry Pi Zero W just now. Builds ok, even though gattlib couldn't build using Python 3 (virtual memory exhausted: Cannot allocate memory error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1).

I used a virtual environment though , and did not try to install it in system folders. Might be that which causes a problem. Try it out and see if it changes anything.

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.59+ #1047 Sun Oct 29 11:47:10 GMT 2017 armv6l GNU/Linux
pi@raspberrypi:~ $ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

pi@raspberrypi:~ $ sudo apt-get update
[...]
pi@raspberrypi:~ $ sudo apt-get dist-upgrade
[...]
pi@raspberrypi:~ $ sudo apt install pkg-config python-dev libboost-python-dev libboost-thread-dev libglib2.0-dev libbluetooth-dev git
[...]
pi@raspberrypi:~ $ sudo apt-get install python-virtualenv
[...]
pi@raspberrypi:~ $ virtualenv testenv2 -p python
pi@raspberrypi:~ $ source testenv2/bin/activate

(testenv2) pi@raspberrypi:~ $ pip install git+https://github.com/mbientlab/pygattlib.git@master#egg=gattlib
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting gattlib from git+https://github.com/mbientlab/pygattlib.git@master#egg=gattlib
  Cloning https://github.com/mbientlab/pygattlib.git (to revision master) to /tmp/pip-install-5TrCMV/gattlib
Building wheels for collected packages: gattlib
  Running setup.py bdist_wheel for gattlib ... done
  Stored in directory: /tmp/pip-ephem-wheel-cache-EetGV4/wheels/46/aa/da/00b8ed47c768da43e25f3bb77f06e4591ae39602f5bd3912cb
Successfully built gattlib
Installing collected packages: gattlib
Successfully installed gattlib-0.20171002

(testenv2) pi@raspberrypi:~ $ pip install metawear
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting metawear
  Downloading https://files.pythonhosted.org/packages/44/8b/c46ca6d7f34f03c1b289141030d1d7ef3f8c6c5ee37ce087af111ae27f13/metawear-0.3.1.tar.gz (373kB)
    100% |████████████████████████████████| 378kB 1.1MB/s 
Requirement already satisfied: gattlib==0.20171002 in ./testenv2/lib/python2.7/site-packages (from metawear) (0.20171002)
Collecting requests (from metawear)
  Downloading https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl (88kB)
    100% |████████████████████████████████| 92kB 1.1MB/s 
Collecting urllib3<1.23,>=1.21.1 (from requests->metawear)
  Downloading https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl (132kB)
    100% |████████████████████████████████| 133kB 1.3MB/s 
Collecting idna<2.7,>=2.5 (from requests->metawear)
  Downloading https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 1.0MB/s 
Collecting chardet<3.1.0,>=3.0.2 (from requests->metawear)
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 1.4MB/s 
Collecting certifi>=2017.4.17 (from requests->metawear)
  Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
    100% |████████████████████████████████| 153kB 1.3MB/s 
Building wheels for collected packages: metawear
  Running setup.py bdist_wheel for metawear ... done
  Stored in directory: /home/pi/.cache/pip/wheels/78/f7/d7/fb979e0d003d1d9468554e497918ffe5b87d4d010ade27a6d9
Successfully built metawear
Installing collected packages: urllib3, idna, chardet, certifi, requests, metawear
Successfully installed certifi-2018.4.16 chardet-3.0.4 idna-2.6 metawear-0.3.1 requests-2.18.4 urllib3-1.22

(testenv2) pi@raspberrypi:~ $ pip install pymetawear
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pymetawear
  Downloading https://files.pythonhosted.org/packages/41/3a/eee643c1923643143591dd52127f9d5fecd42283037968a5b2c47861e0a5/pymetawear-0.9.1-py2.py3-none-any.whl
Requirement already satisfied: metawear>=0.3.1 in ./testenv2/lib/python2.7/site-packages (from pymetawear) (0.3.1)
Requirement already satisfied: gattlib==0.20171002 in ./testenv2/lib/python2.7/site-packages (from metawear>=0.3.1->pymetawear) (0.20171002)
Requirement already satisfied: requests in ./testenv2/lib/python2.7/site-packages (from metawear>=0.3.1->pymetawear) (2.18.4)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in ./testenv2/lib/python2.7/site-packages (from requests->metawear>=0.3.1->pymetawear) (1.22)
Requirement already satisfied: idna<2.7,>=2.5 in ./testenv2/lib/python2.7/site-packages (from requests->metawear>=0.3.1->pymetawear) (2.6)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./testenv2/lib/python2.7/site-packages (from requests->metawear>=0.3.1->pymetawear) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in ./testenv2/lib/python2.7/site-packages (from requests->metawear>=0.3.1->pymetawear) (2018.4.16)
Installing collected packages: pymetawear
Successfully installed pymetawear-0.9.1

Did you install to system (pip install x directly) or user folders (pip install --user x) or virtualenv (seen above)?

@onshoremanover Did you try it again on your RPi Zero?

@onshoremanover Nice going with the swap-file solution. A good solution that I did not think of.

The examples are only meant to be just that, examples available in the Github source code. They are not distributed with the code that is installed through pip, and are not meant to be either. Only the pymetawear folder of the repo is actual code to be distributed and installed.

But if you copy sensorfusion.py to your RPi Zero, to any folder you like, and run it with your virtual environment activated (you should name it something more descriptive than testenv :) ):

(testenv) pi@raspberrypi:~ $ python sensorfusion.py

does it not do a BLE scan and detect devices and then connect to your Metawear board?

It you run a python-script or program with the python-interpreter in a virtual environment (type which python to see which interpreter will be used), it will have access to all packages installed in the virtual environment. So use the sensorfusion.py script as a template and modify and expand according to whatever your needs are. That file is really all that you need once the package is installed.

Does it sound reasonable? I am afraid I cannot help you with solving the install in system python and not in virtual environment problem. I have not got the time to do that right now, and if it works inside a virtual environment I think that is more than enough; it is in my opinion a superior solution.

Closing the issue now. Feel free to continue asking questions about this problem here though.