Is micropython-lib included into micropython?

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
amartino
Posts: 6
Joined: Mon Feb 20, 2017 11:00 am

Is micropython-lib included into micropython?

Post by amartino » Tue Feb 21, 2017 1:02 am

Hi there,
I have built micropython from source for the esp8266 using the following steps on Ubuntu 16.10.

mkdir micropython-contribute
cd micropython-contribute/
sudo apt-get install make unrar-free autoconf automake libtool gcc g++ gperf \
flex bison texinfo gawk ncurses-dev libexpat-dev python-dev python python-serial \
sed git unzip bash help2man wget bzip2 libtool-bin
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
cd esp-open-sdk
make
export PATH=$PATH:$PWD/xtensa-lx106-elf/bin
cd ..
git clone https://github.com/micropython/micropython.git
cd micropython
git submodule update --init
make -C mpy-cross
cd esp8266
make axtls
make
esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 build/firmware-combined.bin


The board boots normally, but I can't import the module that was usually available on the esp8266-20170108-v1.8.7.bin.
The line in question is: from umqtt.simple import MQTTClient
Fails with: ImportError: no module named 'umqtt'

Is micropython-lib by default included in every build of micropython or is this defined by some configurations prior the build?

User avatar
dhylands
Posts: 3234
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Is micropython-lib included into micropython?

Post by dhylands » Tue Feb 21, 2017 2:59 am

micropython-lib isn't included in any builds. You need to install the bits and pieces that you want. Including all of micropython-lib wouldn't fit on most of the embedded platforms.

gaza
Posts: 2
Joined: Mon Mar 05, 2018 9:15 am

Re: Is micropython-lib included into micropython?

Post by gaza » Wed May 08, 2019 11:59 am

How to add the umqtt.simple module before MAKE?
I am looking for information, but I can not find anything

Need to copy files from umqtt.simple to / lib?

User avatar
Roberthh
Posts: 1695
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Is micropython-lib included into micropython?

Post by Roberthh » Wed May 08, 2019 12:05 pm

If you want to include a module in the firmware, you have to copy that into the modules subdirectory of the specific port before running 'make'. You will also find already some other modules there. In the ESP32 port you have already umqtt.

gaza
Posts: 2
Joined: Mon Mar 05, 2018 9:15 am

Re: Is micropython-lib included into micropython?

Post by gaza » Wed May 08, 2019 12:38 pm

Thank You :) running :)

Post Reply