MetaHub Issue-Python fail install metawear

Hi,

Board Information:
i'm using your MetaHub+MetMotionR.

I'm trying to buil my own app on the MetaHub with Python.
When I follow the Tutorial https://mbientlab.com/tutorials/LPython2.html, when I try to "sudo pip install metawear" the MetaHub start to overheat and fail the installation. I've tried both Pyton2.7 and Python3.

If i didn't install the metawear library I can't use the Python-SDK examples and build my App.

I really appeciate your support.

Thanks in advance.

Best Regards,
Caterina Russo

Comments

  • Can you post more information, screenshots, videos? Please refer to "How to Post"

  • Hi Laura,
    thanks for your answer.
    Sure, this is what I get when I try the command "sudo pip install metawear" :

    pi@raspberrypi:~ $ sudo pip install metawear
    Collecting metawear
    Using cached https://files.pythonhosted.org/packages/f0/f2/804d95c4adffb09cafc2bd388b1c5e92c1936a20cdd486d348f5024d3ac0/metawear-0.7.0.tar.gz
    Requirement already satisfied: requests in /usr/lib/python2.7/dist-packages (from metawear)
    Requirement already satisfied: warble<2.0,>=1.1 in /usr/local/lib/python2.7/dist-packages (from metawear)
    Building wheels for collected packages: metawear
    Running setup.py bdist_wheel for metawear ... \

    And then the raspberry remains stuck.
    I've waited a lot of time but nothing change.

    Please write me if you need more info

    Best Regards,
    Caterina Russo

  • Why are you installing something that is already installed on the Metahub?
    It seems you are running our of stack/mem space on the install.

  • Dear Laura,
    ups...you're right! thank you so much! Now with Python everithing it is fine.

    Instead, when I try to use the Javascript exmples (I've tried with sudo node multi_dev.js) I've got this:
    pi@raspberrypi:~/MetaWear-SDK-JavaScript/examples $ sudo node multi_device.js
    module.js:550
    throw err;
    ^

    Error: Cannot find module 'debug'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object. (/home/pi/MetaWear-SDK-JavaScript/lib/metawear.js:4:13)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)

    Please could you help me again?
    Thank you so much for your answers.

    Best Regards,
    Caterina Russo

  • edited January 2020
  • Dear Laura,
    thanks for your answers.
    I would lik to ask you a more generic question. The goal of my research project is to connect and logging data for 9 sensors simoultanusly for a short time I have to recod some sport activities (few minutes of logging, then download and again logging). Which is the best way of proceed? It is better to modify the Metawear app already install on the MetaHub or build a completly new app (in Python or JavaScript) ?
    I really appreciate your help.
    Best Regards,
    Caterina

  • I recommend our Javascript libraries running on a Linux system. A raspberryPi is ok but a full Linux computer would be better (something like an Intel Nuc running Ubuntu for example). Our Javascript APIs run on a more reliable bluetooth backend.

  • Dear Laura,
    thank you for you kind reply.
    I would like to try in Python a very basic code: connect two sensors (simultaneously) to the same dongle hci0 and I want that one blink the led in red and the other one pulse the led in blue.
    this is the code (a modification of the example present in the Tutorial):

    from future import print_function
    from mbientlab.metawear import MetaWear, libmetawear
    from mbientlab.metawear.cbindings import *

    from mbientlab.warble import*
    from mbientlab.metawear import*

    from time import sleep
    from threading import Event

    e = Event()
    import sys

    device_one = MetaWear('DC:57:4A:57:13:DA',d='hci0')
    device_one.connect()
    device_two = MetaWear('C4:F6:3B:81:69:F8',d='hci0')
    device_two.connect()

    print("Connect to"+device_one.address+" and to "+device_two.address)

    But I always get this error:
    pi@raspberrypi:~/MetaWear-SDK-Python/examples $ python led3.py
    error 1580322613.414073: Error on line: 296 (src/blestatemachine.cc): Operation now in progress
    Traceback (most recent call last):
    File "led3.py", line 16, in
    device_one.connect()
    File "/home/pi/.local/lib/python2.7/site-packages/mbientlab/metawear/metawear.py", line 160, in connect
    raise RuntimeError("Error initializing the API (%d)" % (self._init_status))
    RuntimeError: Error initializing the API (64)

    I have read how the MetaWear object works, but I cannot understand why this cannot connect with two devices. Of course, with just one everything works fine.
    If you could help me again, I would really appreciate it! (It's probably something I'm missing ...)

    Best Regards,
    Caterina

  • edited January 2020

    Caterina, Unfortunately we are a small team and don't have the resources to fix your code and teach you how to use our APIs.

    As such, I would recommend trying out the MetaHub because it comes with a bunch of code already loaded for you that allows you to connect to multiple devices (The MetaBase app for linux comes with your MetaHub).

    Alternatively, you can learn to get really proficient at Python scripting, then read through our APIs, docs, and examples and go from there (you will be able to handle errors and fix bugs as they come up in your code).

    The issue here is simply that you need to be a expert software developer to use our APIs. You can hire one or become one.

  • Dear Laura,

    maybe I'm not so good at developing my app, but at least I'd like to use your MetaBase app in the MetaHub that I bought.

    The problem is that it is completely unreliable in the connection with just one sensor.
    I'm just running your app as it is (I obviously just change the MAC address in the .json file) and if I'm lucky I can stream/log one sensor once in ten.
    I hope you can give me some advice, because this time my code skills aren't involved.

    Thank you again for your time.
    Best Regards,
    Caterina

  • Hi Caterina,

    Thank for clarifying that. It should be reliable and work if you use the MetaBase App on the hub but the errors you showed me are with Python. Our MetaBase app runs on Javascript so you must not be using it.

  • Dear Laura,

    yes I know that your MetaBase runs on Javascript, the Python error (in the below post) is related to my own App that I would like to build (with no success).

    Now my problem is that I am trying to use your MetaBase app already installed in my MetaHub. I read the README file and understood how to edit the .json file. In this case I am not coding and I just changed the MAC address in the json file with my MAC address sensor, but when I run the MetaBase app on MetaHub nothing happens (neither streaming nor registration).
    When I wrote that it is not reliable, I mean that the connection works once and nine times it fails.

    I hope I have explained myself better.
    Thank for your time.
    Best regards,
    Caterina

  • Hi Caterina,
    What you are describing is very normal. Bluetooth isn't always guaranteed to connect so you have to write code to automatically handle reconnects. I recommend doing this in your Python App (just retry the connect every 20 seconds until it works for example).

  • Dear Laura,
    thanks for your answers and your time. I will try.
    Best Regards,
    Caterina

Sign In or Register to comment.