Hi,
I am trying to get mqtt installed on the Rpi 4B that holds the hzeller/rpi-rgb-led-matrix, so I can run scripts to show images, video, whatever.
In the /home/dietpi/rpi-rgb-led-matrix/bindings/python directory, and have followed the readme on rpi-rgb-led-matrix/bindings/python at master · hzeller/rpi-rgb-led-matrix · GitHub
and I can’t get past the make build-python step.
I get this error where it can’t find “Imaging.h”.
You can see this in rpi-rgb-led-matrix/bindings/python/rgbmatrix/shims/pillow.c at master · hzeller/rpi-rgb-led-matrix · GitHub here:
#include “Imaging.h”
#include “pillow.h”
int** get_image32(void* im) {
ImagingMemoryInstance* image = (ImagingMemoryInstance*) im;
return image->image32;
}
So… where’s “Imaging.h” at the top there?
Edit:
I’ve also tried bypassing this make build-python step with sudo pip3 install . --break-system-packages but the same stumbling block appears, “Imaging.h”.
I haven’t tried that.
Instead, after posting this topic, I tried following this topic and after installing missing things, stumbling through, and crossing my fingers, I got things working.
I’m having this issue as well on a freshly imaged version of Raspberry Pi Trixie OS (recently released and comes after Bookworm). I had to write a custom shim / hack to make it work for my personal use.
The #1 problem is this Imaging.h error. I fixed that with a shim bash script that removes 'rgbmatrix/shims/pillow.c' from the sources array here: rpi-rgb-led-matrix/bindings/python/setup.py at master · hzeller/rpi-rgb-led-matrix · GitHub
The #2 issue is this:
The disutils was removed from the newer Python and this line fails. It’s appropriately commented here which is good. My fix is I just put these two files in another part of the codebase Python is aware of and it just injects the proper import without touching the rgbmatrix library directly.
src/shim/distutils/core.py (my own folder in my project)
# Provides: setup, Extension
from setuptools._distutils.core import *
# The entire necessity for this shim is the rgbmatrix library.
# It has a setup.py script that relies on an older version of Python <= 3.12
# That version is importing a package which is now removed from standard lib
# So we use a shim here to load it into the namespace manually
# Until such time the vendor can patch this with a fix.
src/shim/distutils/__init__.py
# minimal distutils shim (Python 3.12+)
import importlib
import sys
try:
_sd = importlib.import_module("setuptools._distutils")
except Exception as exc:
raise ImportError(
"distutils is not available and setuptools._distutils "
"was not found. Install or upgrade setuptools."
) from exc
# Register the top-level distutils module as this shim
# and ensure submodules resolve correctly.
sys.modules.setdefault("distutils", sys.modules[__name__])
# Expose submodules dynamically
for sub in ("core",):
try:
sys.modules[f"distutils.{sub}"] = importlib.import_module(f"setuptools._distutils.{sub}")
except ImportError:
pass
@marcmerlin @Chris11jed