Can't install module through upip, error message is not clear

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
gscofano
Posts: 3
Joined: Wed Dec 22, 2021 4:13 am

Can't install module through upip, error message is not clear

Post by gscofano » Mon Jan 31, 2022 6:54 am

I'm trying to work with the Tronpy module in Micropython. It works fine when I'm using CPython. However, in micropython, I tried to install it and got an error message. I'm using Fedora 34.

Code: Select all

$ micropython -m upip install tronpy
Installing to: /home/user/.micropython/lib/
Warning: micropython.org SSL certificate is not validated
Error installing 'tronpy': , packages may be partially installed
I'm new to Micropython and this error message isn't helpfull at all. How can I track the nature of this error and solve it?

Thank you very much in advance.

User avatar
josverl
Posts: 15
Joined: Fri Nov 24, 2017 4:22 pm

Re: Can't install module through upip, error message is not clear

Post by josverl » Tue Feb 01, 2022 8:10 am

What Micropython version are you using ?
If its an older version (MicroPython < 1.14 ?) then I remember issues with a certificate change that caused similar issues until upip had been updated.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Can't install module through upip, error message is not clear

Post by pythoncoder » Tue Feb 01, 2022 10:48 am

The message
Warning: micropython.org SSL certificate is not validated
occurs even on a successful install.

However the next line does indicate an error. It really is unclear why some packages won't install - upip isn't very user friendly in this respect.

In this instance Tronpy is a CPython package which probably cannot run on a microcontroller. In general packages need some changes to run on microcontrollers, and in some cases the changes are major (e.g. Numpy).
Peter Hinch
Index to my micropython libraries.

gscofano
Posts: 3
Joined: Wed Dec 22, 2021 4:13 am

Re: Can't install module through upip, error message is not clear

Post by gscofano » Thu Feb 03, 2022 12:40 am

I got this question answered in StackOverflow, I'll post the link for future reference: https://stackoverflow.com/questions/709 ... -not-clear

I tried Micropython 1.13 and 1.18, both returned the same error.

According to the answer in StackOverflow, the modules must be packaged specifically for Micropython which, unfortunatelly, was not the case for Tronpy. As suggested in the answer, in PyPI.org, if I search for Tronpy, the search engine finds the package. If I filter for Micropython packages only, the query returns nothing, confirming that this package is not available for Micropython.

The answer in StackOverflow also showed a nice way to debug upip messages:

Code: Select all

$ ./micropython 
MicroPython v1.18-5-g037b2c72a-dirty on 2022-02-02; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> import upip
>>> upip.debug = True
>>> upip.install("Tronpy")
Installing to: /home/gscofano/.micropython/lib/
Queue: ['Tronpy']
https://micropython.org/pi/Tronpy/json
Warning: micropython.org SSL certificate is not validated
https://pypi.org/pypi/Tronpy/json
Error installing 'Tronpy': Package not found, packages may be partially installed
Now, upip tells me that the package was not found.

Thank you all who contributed.

Post Reply