adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
MIT License
3.97k stars 1.16k forks source link

can't load adafruit_dotstar library on unexpectedmaker feather S2 #8302

Closed gmparis closed 11 months ago

gmparis commented 11 months ago

CircuitPython version

Adafruit CircuitPython 8.2.3 on 2023-08-11; FeatherS2 with ESP32S2
Board ID:unexpectedmaker_feathers2

Code/REPL

import adafruit_dotstar

Behavior

Traceback (most recent call last): File "", line 1, in File "adafruit_dotstar.py", line 44, in ImportError: no module named 'adafruit_pypixelbuf'

Description

Complains about missing adafruit_pypixelbuf. Tried replacing adafruit_dotstar.mpy with the .py version, as the code does not have the "py" in pixelbuf, but that did not help. Module must be part of what has been flashed to the device in 8.2.3.

Additional information

Can't figure a workaround. Board will not work with dotstars.

DJDevon3 commented 11 months ago

The check for adafruit_pypixelbuf was removed in March of 2022. You're using an outdated library bundle. Please grab a more recent Bundle for Version 8.x

I would recommend keeping the datestamp of the bundle when you download and unzip it. They're in this format:

When you get the latest version of Circuit Python 8.2.3 as of today you should also snag the latest version of the bundle package, bundles are updated too.

It's possible at one time the UM Feather S2 was using a frozen library version as I found a line for it in the mpconfigboard.mk for the UM Feather S2 here. It seems to be commented out now and no longer using the frozen library. Unsure what to make of that. If it is a frozen library and included then why is it pulling a version of adafruit_dotstar from prior to March 2022?

gmparis commented 11 months ago

I am using the one dated 20230815.

On Sun, Aug 20, 2023 at 8:46 PM DJDevon3 @.***> wrote:

The check for adafruit_pypixelbuf was removed in March of 2022 https://github.com/adafruit/Adafruit_CircuitPython_DotStar/commit/fdc63e80404e7405489ac5922addf06a92093aba. You're using an outdated library bundle. Please grab a more recent Bundle for Version 8.x https://circuitpython.org/libraries

— Reply to this email directly, view it on GitHub https://github.com/adafruit/circuitpython/issues/8302#issuecomment-1685458258, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF37LIKYEYK4NP7632E4FTDXWKVUZANCNFSM6AAAAAA3XHYXD4 . You are receiving this because you authored the thread.Message ID: @.***>

DJDevon3 commented 11 months ago

Then it should be using the latest version of adafruit_dotstar... I would hope.

The error you're getting means the frozen library for adafruit_dotstar in 8.2.3 for the UM Feather S2 is using a version of that library from March 2022. I have no idea why.

gmparis commented 11 months ago

In the meantime I flashed the prior version of CircuitPy (8.2.2) and the problem was rectified. Same library bundle.

On Sun, Aug 20, 2023 at 9:15 PM DJDevon3 @.***> wrote:

Then it should be using the latest version of adafruit_dotstar https://github.com/adafruit/Adafruit_CircuitPython_DotStar/blob/67f8c35e2ce4a8abc3cfb24ab5029b40a64857b8/adafruit_dotstar.py... I would hope.

— Reply to this email directly, view it on GitHub https://github.com/adafruit/circuitpython/issues/8302#issuecomment-1685476907, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF37LINMNYWFBTGCC7CNXL3XWKZCTANCNFSM6AAAAAA3XHYXD4 . You are receiving this because you authored the thread.Message ID: @.***>

DJDevon3 commented 11 months ago

If you perhaps had an adafruit_dotstar.py in the same /lib folder it would override the adafruit_dotstar.mpy from the bundle. Then deleting the adafruit_dotstar.py allowed the .mpy file to be used. ;)

gmparis commented 11 months ago

This was an otherwise new S2 I had in a drawer for a long time. I flashed to 8.2.3 and it no longer ran the sample code that flashes the dotstar. At this point /lib was empty, so I loaded the entire bundle into /lib. Still broken at that point. You now have the entire history.

On Sun, Aug 20, 2023 at 9:18 PM DJDevon3 @.***> wrote:

If you perhaps had an adafruit_dotstar.py in the same /lib folder it would override the adafruit_dotstar.mpy from the bundle.

— Reply to this email directly, view it on GitHub https://github.com/adafruit/circuitpython/issues/8302#issuecomment-1685479046, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF37LIN266CZJJHST2ZFQT3XWKZPNANCNFSM6AAAAAA3XHYXD4 . You are receiving this because you authored the thread.Message ID: @.***>

DJDevon3 commented 11 months ago

Only load libraries you currently need or actively use into /lib. The fact that the UM Feather can store the entire bundle is a marvel in itself. That's not what should be done for the bundle... normally. ;) It's currently only one of very few boards with enough flash storage to do that.

gmparis commented 11 months ago

Yes, that's normally what I do. I was being lazy this time. Are you saying this is what caused the issue? I did the same thing for 8.2.2 and there is no issue with it.

On Sun, Aug 20, 2023 at 9:30 PM DJDevon3 @.***> wrote:

Only load libraries you currently need or actively use into /lib. The fact that the UM Feather can store the entire bundle is a marvel in itself. That's not what should be done for the bundle... normally. ;) It's currently only one of very few boards with enough flash storage to do that.

— Reply to this email directly, view it on GitHub https://github.com/adafruit/circuitpython/issues/8302#issuecomment-1685486843, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF37LIKDX6P7ZNMXDVZXS53XWK23RANCNFSM6AAAAAA3XHYXD4 . You are receiving this because you authored the thread.Message ID: @.***>

DJDevon3 commented 11 months ago

Most likely yes the .py file sounds like it was an old version that was overriding the newer .mpy from the bundle. Try reinstalling 8.2.3 and use only the bundle .mpy libraries that you need in /lib which is typically only like 3-4 libraries in /lib that you're actively using. If that works and you're sure your issue is resolved please close the issue report. Hopefully that's all it is!

DJDevon3 commented 11 months ago

Figured out you did nothing wrong. Unexpected Maker ships the board pre-installed with Circuit Python and an adafruit_dotstar.py in the root directory which will override any adafruit_dotstar.py or .mpy in the /lib folder. That's the issue.

Capture

Delete that file and upload a newer version from the 8.x bundle to /lib and should be good to go. Was unaware of this issue.. I'm sure we'll definitely see it pop up again someday.

dhalbert commented 11 months ago

tagging @UnexpectedMaker

UnexpectedMaker commented 11 months ago

This was an otherwise new S2 I had in a drawer for a long time. I flashed to 8.2.3 and it no longer ran the sample code that flashes the dotstar. At this point /lib was empty, so I loaded the entire bundle into /lib. Still broken at that point. You now have the entire history.

Key point here is "had it for a long time" and now just re-flashed it. The shipping code that was on there was a much older version of the files, and new shipping files are available (as always) from here... https://github.com/UnexpectedMaker/feathers2/tree/main/FeatherS2/CircuitPython

Or as @DJDevon3 stated, delete the version of the dotstar library I shipped and then it should use the version from the bundle.

gmparis commented 11 months ago

I never looked in the top level. Duh. When I went to 8.2.2, I did an erase, which must have eliminated the unwanted .py file, correcting the issue.

Thank you for your assistance.

On Mon, Aug 21, 2023 at 12:22 AM Unexpected Maker @.***> wrote:

This was an otherwise new S2 I had in a drawer for a long time. I flashed to 8.2.3 and it no longer ran the sample code that flashes the dotstar. At this point /lib was empty, so I loaded the entire bundle into /lib. Still broken at that point. You now have the entire history. … <#m-6995811300477154901>

Key point here is "had it for a long time" and now just re-flashed it. The shipping code that was on there was for a much older version of the files, and new shipping files are available (as always) from here...

https://github.com/UnexpectedMaker/feathers2/tree/main/FeatherS2/CircuitPython

— Reply to this email directly, view it on GitHub https://github.com/adafruit/circuitpython/issues/8302#issuecomment-1685618706, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF37LILZ4PX3GLKLTLZIR33XWLPABANCNFSM6AAAAAA3XHYXD4 . You are receiving this because you authored the thread.Message ID: @.***>

dhalbert commented 11 months ago

Thanks @UnexpectedMaker.

CrackXT commented 2 months ago

Hello CircuitPython Team,

the adafruit_dotstar.py code that is flashed during the installation of CP 9.0.4 as well as in the 9.1.0-beta1 is incompatible.

Please replace the adafruit_dotstar.py with the new version of UnexpectedMaker.

https://github.com/UnexpectedMaker/feathers2/blob/main/FeatherS2/CircuitPython/adafruit_dotstar.py

This works again with both CP versions.

With kind regards CrackXT

UnexpectedMaker commented 2 months ago

Hello CircuitPython Team,

the adafruit_dotstar.py code that is flashed during the installation of CP 9.0.4 as well as in the 9.1.0-beta1 is incompatible.

Please replace the adafruit_dotstar.py with the new version of UnexpectedMaker.

https://github.com/UnexpectedMaker/feathers2/blob/main/FeatherS2/CircuitPython/adafruit_dotstar.py

This works again with both CP versions.

With kind regards CrackXT

What is not working with the latest Dotstar library? Maybe post your issue rather than asking Adafruit to revert their changes?

CrackXT commented 2 months ago

The adafruit_dotstar.py in the CP 9.0.4 package (.uf2), as well as in the 9.1.0-beta1 does not seem to be compatible with CP 9. The LED is off after the update, only if you flash your (linked) code over the one from the CP 9 package, the LED is on again.

With kind regards CrackXT

jepler commented 2 months ago

A better place to discuss problems using the Adafruit CircuitPython dotstar library is in that github repo: https://github.com/adafruit/Adafruit_CircuitPython_DotStar -- creating a new issue there with a full description of the problem you're having would be a great idea. Please include the code you're using as well as describing the behavior you see and any messages that are shown "in the REPL".

Generally, around the time each CircuitPython release is made, each frozen library is updated to match the latest released version from its repository. Occasionally this doesn't happen due to oversight, but frozen modules were updated on April 17 for the 9.1.0-beta.1 release. If something's going wrong with this update process, or it was forgotten, then this is a good place to raise the issue.

If a change is needed for the LEDs to work right, the place to offer a pull request is in https://github.com/adafruit/Adafruit_CircuitPython_DotStar

In the specific case of Unexpected Maker devices in particular, there appears to be the extra wrinkle that some devices are shipped with .py and/or .mpy files loaded in the CIRCUITPY drive that can take precedence over the "frozen" version even after you update circuitpython, so do check if there are other dotstar "py" or "mpy" files on your device; you can also do a storage.erase_filesystem() to totally erase the CIRCUITPY drive (including your code.py, so back it up); after this step the "frozen" version should be the one that import finds.