Gen_mpy.py cannot import name lru_cache

I would like to bring LVGL into the LoBo (https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo/wiki/) Micropython in order to be able to use this GUI library there.

First I cloned the Micropython according to these instructions (https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo/wiki/build). Without the following steps, everything goes smoothly for compiling and flashing.

Next, according to these instructions (https://github.com/lvgl/lv_binding_micropython#adding-micropython-bindings-to-a-project) I tried to implement LVGL. In micropython / lib I first cloned the lv_binding_micropython from git, changed the required files and tried to run gen_mpy.py. This crashes with the following error message:

Traceback (most recent call last):
File “gen_mpy.py”, line 17, in
from functools import lru_cache
ImportError: cannot import name lru_cache

Now I don’t know what to do next. I’ve installed and tried it on Ubuntu (WSL), Debian (WSL) and Kali (WSL), as well as Ubuntu (desktop). I’m assuming there is a problem with gen_mpy.py.

What I specifically entered:

sudo apt-get update
sudo apt-get install git wget make libncurses-dev flex bison gperf python
git clone --depth 1 https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo.git
cd MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/
./BUILD.sh menuconfig
cd micropython/lib/
git clone https://github.com/lvgl/lv_binding_micropython.git
cd lv_binding_micropython/gen
python gen_mpy.py
>>>Traceback (most recent call last):
  File "gen_mpy.py", line 17, in <module>
    from functools import lru_cache
ImportError: cannot import name lru_cache

Hi @Christian_Draxl !

Is lobo fork still alive?!?
Last commit there was made on 2018.
From what I’ve heard, @loboris abandoned this project long ago and moved on to Kendryte K210.

Would it be a good idea to spend time and effort supporting an abandoned project, with no maintainer?

I would suggest putting the effort into an active fork of Micropython. The are quite a few which are maintained and much more active than lobo’s.

Well, you can run gen_mpy.py directly, but this is not how it’s usually done.
The idea is that gen_mpy.py should run as part of the build process, and not manually, otherwise you would have to re run it every time LVGL changes (and it changes a lot!)

So have a look at the Makefiles and see how gen_mpy.py is called as part of the build.

Are you using Python3? Python2 has reached end-of-life as you probably know.
I think that lru_cache is only supported on Python3.