PiRogueToolSuite / deb-packages

PiRogue Debian packages
https://pts-project.org/
GNU General Public License v3.0
2 stars 2 forks source link

pirogue-screen-st7789-240x240.service fails to start: ModuleNotFoundError: No module named 'RPi._GPIO' #10

Closed CyrilBrulebois closed 1 year ago

CyrilBrulebois commented 1 year ago

While investigating DTB/DTBO tweaks to have all components of the PiRogue Hat up and running on Debian 12 and its mainstream kernel (as opposed to the rpi one), I've tried installing the pirogue screen package, but its service unit didn't want to start:

Jun 20 22:58:25 rpi4-20230620 systemd[1]: Starting pirogue-screen-st7789-240x240.service - PiRogue screen...
Jun 20 22:58:26 rpi4-20230620 pirogue-screen-st7789-240x240[2437]: Traceback (most recent call last):
Jun 20 22:58:26 rpi4-20230620 pirogue-screen-st7789-240x240[2437]:   File "/usr/sbin/pirogue-screen-st7789-240x240", line 14, in <module>
Jun 20 22:58:26 rpi4-20230620 pirogue-screen-st7789-240x240[2437]:     from board import SCK, MOSI, MISO, CE0, D24, D25, D4, D11, D5, D6
Jun 20 22:58:26 rpi4-20230620 pirogue-screen-st7789-240x240[2437]:   File "/usr/lib/pirogue/screen-st7789-240x240/board.py", line 62, in <module>
Jun 20 22:58:26 rpi4-20230620 pirogue-screen-st7789-240x240[2437]:     from adafruit_blinka.board.raspberrypi.raspi_4b import *
Jun 20 22:58:26 rpi4-20230620 pirogue-screen-st7789-240x240[2437]:   File "/usr/lib/pirogue/screen-st7789-240x240/adafruit_blinka/board/raspberrypi/raspi_4b.>
Jun 20 22:58:26 rpi4-20230620 pirogue-screen-st7789-240x240[2437]:     from adafruit_blinka.microcontroller.bcm2711 import pin
Jun 20 22:58:26 rpi4-20230620 pirogue-screen-st7789-240x240[2437]:   File "/usr/lib/pirogue/screen-st7789-240x240/adafruit_blinka/microcontroller/bcm2711/pin>
Jun 20 22:58:26 rpi4-20230620 pirogue-screen-st7789-240x240[2437]:     import RPi.GPIO as GPIO
Jun 20 22:58:26 rpi4-20230620 pirogue-screen-st7789-240x240[2437]:   File "/usr/lib/pirogue/screen-st7789-240x240/RPi/GPIO/__init__.py", line 23, in <module>
Jun 20 22:58:26 rpi4-20230620 pirogue-screen-st7789-240x240[2437]:     from RPi._GPIO import *
Jun 20 22:58:26 rpi4-20230620 pirogue-screen-st7789-240x240[2437]: ModuleNotFoundError: No module named 'RPi._GPIO'

That persists even after installing packages that looked like might be relevant:

sudo apt-get install python3-rpi.gpio rpi.gpio-common

so we should probably check what we shipped in the package, and/or external dependencies that haven't been documented in a way a missing package would be spotted when deploying the package on a pristine Debian base.

CyrilBrulebois commented 1 year ago

Investigations led to the following discoveries:

The latter is very good news, since the existing package is quite hacky, having bundled a bunch of pip-obtained modules into our package: we didn't pay too high a price to get everything available in Debian packages the last time around, and all the crap we put together at the time is about to just go away!

CyrilBrulebois commented 1 year ago

We can also clean up the top-level build.sh (mainly comments, inside a case statement).

U039b commented 1 year ago

We will drop all the current packaged-ish dependencies when we switch to spidev and libgpiod.

CyrilBrulebois commented 1 year ago

I think most of the clean-up should be fine now. I'll let you take ownership and port the code.

U039b commented 1 year ago

I just tested the new Python code relying on python3-libgpiod and python3-spidev (instead of Adafruit Blinka and other pasta soup) works just fine on RaspberryPi OS.

CyrilBrulebois commented 1 year ago

Great, closing then!