I'm starting my fist cloud project with an non-Arduino ESP32. I've flashed it with the micropython firmware (ESP32_GENERIC-20240222-v1.22.2). I followed the instructions on the Arduino website to install the cloud library using mpremote. I was warned the installation may have been partial due to SSL certificates, but when checking the lib folder on the ESP32 via Arduino Lab for MicroPython, all the files appear to be there. When I copied the sample code over to the ESP32 and ran it, I got ImportError: no module named 'logging'. And I have no idea what to do! I'm sure there is more specific information needed to help solve my problem, please let me know and I'm happy to provide.
Hi @bcade04. You can learn how to import MicroPython modules to your ESP32 board from this tutorial:
https://docs.arduino.cc/micropython/basics/installing-modules/
I followed the "Option 2: Mpremote" instructions and used this command to import the logging
module dependency of that script to my board:
mpremote connect id:<board ID> mip install logging
(where <board ID>
was the ID of my board, which I found by running the mpremote connect list
command, per the instructions in the tutorial)
Thanks for the reply. Here's the output on the terminal window after running the command:
mpremote connect id:0001 mip install logging
Install logging
Installing logging (latest) from https://micropython.org/pi/v2 to /lib
Package may be partially installed
mpremote: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1000) requesting https://micropython.org/pi/v2/package/6/logging/latest.json
I attempted to run the code on the board and I still get the ImportError for the logging module.
Unfortunately I'm not sure about the cause or how best to fix it.
It might be that you are missing or have an outdated CA certificate on your computer. You can try updating them. This is a fairly common thing to do on Linux systems, but not so much on macOS or Linux. Which operating system are you using?
It might also be caused by using an outdated version of Python, or not having the necessary CA certificates Python package installed. Which version of Python did you use to install mpremote
? You can find it by running pip --version
(or if you used a different command than pip
when installing mpremote
, adjust the command accordingly).
Alternatively you could try the "Option 1: MIP" approach from the tutorial:
https://docs.arduino.cc/micropython/basics/installing-modules/#option-1-mip
I'm on Windows11.
Python v3.12.3
pip v24.0
OPTION 1 WORKED! Your help is much appreciated. Thank you!
You are welcome. I'm glad you were able to get the module imported. Thanks for taking the time to post an update with your solution!
In case it might be of value to others who find this topic while experiencing that "mpremote: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired
" error while using the "Option 2: Mpremote" approach, I'll mention that I was using Windows 11, Python 3.12, and pip 23.2.1 when I successfully used mpremote.
I don't have any reason to believe the small differences in the versions of the tools used explain the different result I had compared to @bcade04. I mention this more to say that it is not impossible to use the mpremote approach with this sort of system configuration. But if you have problems with the "Option 2: Mpremote" approach, and the "Option 1: MIP" approach works fine, then there is no reason to spend time trying to solve the mpremote problem.
I arbitrarily chose the "Option 2: Mpremote" approach because I work with Python regularly and so found it slightly more convenient than "Option 1: MIP".
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.