uPyCraft, how to add libraries #13617
-
I'm using uPyCraft on Windows as my IDE for MicroPython on ESP32. I'm able to get the onboard LED blink to work, so everything is connected. I was looking into mqtt, and it says no module named umqttsimple. I have the ESP32 connected to WiFi, but how do I download the library? I'm more used to Python, and I know I can use pip, but what about Micropython? I think there's something called upip for MicroPython, but how do I install that? This is the MQTT tutorial I'm following. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
You're looking for https://docs.micropython.org/en/latest/reference/packages.html#installing-packages-with-mip If your device is connected to the internet, you can install directly on the device: >mpremote
Connected to MicroPython at /dev/ttyACM0
Use Ctrl-] or Ctrl-x to exit this shell
MicroPython v1.22.0 on 2023-11-09; TUUKKA-NUCLEO-WB55 with STM32WB55RGV6
Type "help()" for more information.
>>> import mip
>>> mip.install("umqtt.simple")
Installing umqtt.simple (latest) from https://micropython.org/pi/v2 to /root/.micropython/lib
Copying: /root/.micropython/lib/umqtt/simple.mpy
Done
>>> Or you can 'push' the library to the device by using mip via mpremote over a serial connection. From your PC: > mpremote mip install umqtt.simple
Install umqtt.simple
Installing umqtt.simple (latest) from https://micropython.org/pi/v2 to lib
Installing: lib/umqtt/simple.mpy
Done |
Beta Was this translation helpful? Give feedback.
-
Thank you, I'll try doing that. |
Beta Was this translation helpful? Give feedback.
-
That worked, thank you so much. I ended up using esptool. |
Beta Was this translation helpful? Give feedback.
You're looking for
mip
, MicroPython's answer forpip
:https://docs.micropython.org/en/latest/reference/packages.html#installing-packages-with-mip
If your device is connected to the internet, you can install directly on the device:
Or you can 'push' the library to the device by using mip via mpremo…