-
Hi! I am using micropython with thonnyIDE on my ESP32 for mqtt communication. On thonny, I installed the paho mqtt package. However, as soon as I import it to the main.py of the esp32, this error shows: MemoryError: memory allocation failed, allocating 1979 bytes I've read online that a way to solve this is by precompiling .py to .mpy. How do I do this for the library? Is it as easy as changing the extensions of the files included in the library from .py to .mpy? Is there a better or easier way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You precompile py files to mpy with mpy-cross. However I don't believe that will solve the memory allocation error. Is this paho mqtt library specific to Micropython? Where did you download it? |
Beta Was this translation helpful? Give feedback.
-
I don't think you will get Paho running on an ESP32, regardless of any memory saving techniques. You will most likely need to remove most of it's features and end with something similar to umqtt.simple and umqtt.robust from micropython-lib. |
Beta Was this translation helpful? Give feedback.
I don't think you will get Paho running on an ESP32, regardless of any memory saving techniques. You will most likely need to remove most of it's features and end with something similar to umqtt.simple and umqtt.robust from micropython-lib.