RuntimeError: This module can only be run on a Raspberry Pi!
lisuke opened this issue · 3 comments
lisuke commented
>>> import adafruit_ssd1306
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/alarm/.local/lib/python3.11/site-packages/adafruit_ssd1306.py", line 17, in <module>
from adafruit_bus_device import i2c_device, spi_device
File "/home/alarm/.local/lib/python3.11/site-packages/adafruit_bus_device/spi_device.py", line 20, in <module>
from digitalio import DigitalInOut
File "/home/alarm/.local/lib/python3.11/site-packages/digitalio.py", line 19, in <module>
from adafruit_blinka.microcontroller.bcm283x.pin import Pin
File "/home/alarm/.local/lib/python3.11/site-packages/adafruit_blinka/microcontroller/bcm283x/pin.py", line 5, in <module>
from RPi import GPIO
File "/home/alarm/.local/lib/python3.11/site-packages/RPi/GPIO/__init__.py", line 23, in <module>
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
OS info
-` alarm@alarm
.o+` -----------
`ooo/ OS: Arch Linux ARM aarch64
`+oooo: Host: Raspberry Pi 4 Model B
`+oooooo: Kernel: 6.2.10-1-aarch64-ARCH
-+oooooo+: Uptime: 2 days, 8 hours, 41 mins
`/:-:++oooo+: Packages: 505 (pacman)
`/++++/+++++++: Shell: zsh 5.9
`/++++++++++++++: Terminal: /dev/pts/0
`/+++ooooooooooooo/` CPU: (4) @ 1.500GHz
./ooosssso++osssssso+` Memory: 3101MiB / 3778MiB
.oossssso-````/ossssss+`
-osssssso. :ssssssso.
:osssssss/ osssso+++.
/ossssssss/ +ssssooo/-
`/ossssso+/:- -:/+osssso+-
`+sso+:-` `.-/+oso:
`++:. `-/+/
.` `/
FoamyGuy commented
From the docs page here: https://archlinuxarm.org/wiki/Raspberry_Pi it notes:
GPIO
To be able to use the GPIO pins from Python, use the RPi.GPIO library. Install the python-raspberry-gpio package from the AUR.
have you installed that package from the AUR yet? It seems like that is required setup that you need to do if you want to use the GPIO pins with Arch linux.
lisuke commented
Unfortunately, the maintainer has already deleted the repo and ran away.
What bad luck!
lisuke commented
Now, I have found other available libraries
#!/usr/bin/env python
from luma.core.interface.serial import i2c
from luma.core.render import canvas
from luma.oled.device import ssd1306
from time import sleep
serial = i2c(port=1, address=0x3C)
device = ssd1306(serial, rotate=2)
# Box and text rendered in portrait mode
with canvas(device) as draw:
draw.rectangle(device.bounding_box, outline="white", fill="black")
draw.text((10, 40), "Hello World!", fill="white")
sleep(10)