how to pip3 install properly in order to use LoRa?

  • Hello,
    I'm doing a school project and I received a PyCom device that I'm using on my Raspberry in Python programs.
    My teacher provided me a code but actually I don't understand what I have to pip3 install in order to compile these two imports only: from network import LoRa and import ubinascii. I've managed to understand (I think) that they are from MicroPython but I can't any tutorial on how to setup all of this.
    I have the whole code (which I wasn't supposed to do, just run along with my own piece of code) but I just can't find a way to make it all work... :(
    Thanks in advance!

  • I looked around in the firmware to find any double definitions, but could not find anything concrete why these three are duplicated. Though its probably limited to only the help-function printing code, meaning there's no fundamental flaw in the firmware

  • @livius right. I did not see that, and I have no clue why, and why only these three.

  • @robert-hh
    He ask about same name not without "u" ;-)
    there are e.g. 2xuselect 2xubinascii 2xuerrno

  • @kjm Some modules have a non-u alias for compatibility. Don't ask me why some have and others not. But it's only an alias. The module itself exists only once.

  • @robert-hh Just curious Rob, why are there 2 copies of ubinascii, uselect, etc?

  • @Axel-Carré both network and ubinascii are already embedded into the LoPy4 (I assume it's the one) firmware. So you do not need to install it on the device.

    Edit: You can tell which modules are pre-installed on the Pycom device by the following command in the REPL:


    Then you get a list of installed modules.

    >>> help('modules')
    __main__          machine           sys               upysh
    _boot             math              time              uqueue
    _main             micropython       ubinascii         ure
    _thread           mount             ubinascii         uselect
    array             network           ucollections      uselect
    binascii          os                ucrypto           usocket
    builtins          pycom             uctypes           ussl
    cmath             pye_mp            uerrno            ustruct
    crypto            queue             uerrno            utime
    errno             re                uhashlib          utimeq
    framebuf          select            uio               uzlib
    gc                socket            ujson
    hashlib           ssl               umachine
    json              struct            uos
    Plus any modules on the filesystem

    P.S.: Both modules do NOT exist on the Raspberry Pi. There may be a network module, but with different classes. And instead ubinascii there is binascii. But that is irrelevant, since you have to run your code on the Pycom device, not on the RasPi.

  • @robert-hh Alright so do you know by any chance how to install all the needed libraries?

  • @Axel-Carré pip3 is a installer for the PC handling python3 packages, but the imports you mention run on the LoPy devices. So they are not related. I understand that this is confusing.
    And the pip3 command is not complete. It does not show what pip3 should install.

Log in to reply

Pycom on Twitter