adafruit / Adafruit_Blinka_Displayio

Displayio for Blinka
MIT License
14 stars 20 forks source link

(MicroPython support) ImportError: no module named 'typing' pi pico #109

Closed Nicchessla closed 1 year ago

Nicchessla commented 1 year ago

I am trying to run adafruits HX8357 display with the raspberry pico, running micropython using Blinka. when I import displayio I get the error above

tekktrik commented 1 year ago

Can you post the error traceback?

corlovsky commented 1 year ago

I'm having the same issue. Please see below:

MPY: soft reboot
Chip id:  RP2040
Board id:  RASPBERRY_PI_PICO
Traceback (most recent call last):
  File "<stdin>", line 12, in <module>
  File "/lib/displayio/__init__.py", line 20, in <module>
ImportError: no module named 'typing'
tekktrik commented 1 year ago

@makermelissa should the Pico be able to support importing of typing like the Pi proper does? Here's the relevant line: https://github.com/adafruit/Adafruit_Blinka_Displayio/blob/61102c93bfb90fbccc4bc21122444531ebe2dd84/displayio/__init__.py#L20

makermelissa commented 1 year ago

@tekktrik I'm not sure, but if there is an option of not requiring it, that would be ideal since there's already so little extra space.

tekktrik commented 1 year ago

I'm more surprised because I don't think typing exists and I'm surprised it might only be an issue now. I can do some more digging.

Neradoc commented 1 year ago

Is displayio even compatible with Micropython ? It has seemingly never been tested there, has it ? It's not an issue to use typing without guards in a library that is not supported on MP. This should probably be an issue in https://github.com/adafruit/Adafruit_Blinka_Displayio

tekktrik commented 1 year ago

Issue transferred and name updated!

makermelissa commented 1 year ago

Is displayio even compatible with Micropython ? It has seemingly never been tested there, has it ? It's not an issue to use typing without guards in a library that is not supported on MP. This should probably be an issue in https://github.com/adafruit/Adafruit_Blinka_Displayio

I don't know why I didn't even think about that sooner. Yeah, this library will not run on MicroPython. It requires the Pillow library and I'm fairly sure you need a single board computer for that.

tekktrik commented 1 year ago

Is it fair to close this then? Or should there be any action item?

Nicchessla commented 1 year ago

I don't know why I didn't even think about that sooner. Yeah, this library will not run on MicroPython. It requires the Pillow library and I'm fairly sure you need a single board computer for that.

Displayio is part of CircuitPython, yes? So even if I use CircuitPython on my Raspberry Pi Pico it wouldn't work?

tekktrik commented 1 year ago

Blinka Display IO relies on C python libraries, particularly pillow, in order to function. It isn't designed to run on the Pico.

Neradoc commented 1 year ago

Displayio is part of CircuitPython, yes? So even if I use CircuitPython on my Raspberry Pi Pico it wouldn't work?

To clarify, you can use displayio if you run Circuitpython instead of Micropython, as it is a builtin library of CP. It's a display and graphics library that needs low level access and optimizations. I don't know what Micropython has to offer as graphics libraries, but I believe it has LVGL bindings that can be compiled in (maybe not by default), which you could use independently of whatever blinka libraries you need (like adafruit sensor drivers).

Nicchessla commented 1 year ago

I think now I get it. Blinka is really created for single board computers, and not microcontrollers, right? So, running python with Blinka, displayio would work because of the python libraries mentioned like pillow. Blinka also works in Micropython on a microcontroller but I guess only very limited then. is this correct?

makermelissa commented 1 year ago

@Nicchessla Blinka runs fine on MicroPython. It was really this library that was created for SBCs.

makermelissa commented 1 year ago

Closing as this is pretty much written for linux and not micropython. It would be better to better to either use MicroPython's RGB Display library or go with CircuitPython instead.