Hi, I have the same issue in Raspberry Pi 4B Arch Linux ARMv8. Could you finally get it working? I tried installing AUR package python-raspberry-gpio 0.7.0-2 but it does not work:
$this->bbcode_second_pass_code('', '
$ python
Python 3.8.6 (default, Oct 6 2020, 22:56:58)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import RPi.GPIO
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.8/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!
>>> import RPi.GPIO as GPIO
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.8/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!
')
But I can activate GPIO pins through the command line:
$this->bbcode_second_pass_code('', '
$ ls /sys/class/gpio/
export gpiochip446 gpiochip454 unexport
$ echo "464" > /sys/class/gpio/export
$ ls /sys/class/gpio/gpio464/
active_low device direction edge power subsystem uevent value
')
And also initialize them through python-periphery, but only running a
sudo Python shell for permission issues:
$this->bbcode_second_pass_code('', '$ sudo python
Python 3.8.6 (default, Oct 6 2020, 22:56:58)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from periphery import GPIO
>>> gpio_in = GPIO("/dev/gpiochip0", 10, "in")
>>>
$ python
Python 3.8.6 (default, Oct 6 2020, 22:56:58)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from periphery import GPIO
>>> gpio_in = GPIO("/dev/gpiochip0", 10, "in")
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/periphery/gpio.py", line 530, in _open
self._chip_fd = os.open(path, 0)
PermissionError: [Errno 13] Permission denied: '/dev/gpiochip0'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.8/site-packages/periphery/gpio.py", line 487, in __init__
self._open(path, line, direction, edge, bias, drive, inverted, label)
File "/usr/lib/python3.8/site-packages/periphery/gpio.py", line 532, in _open
raise GPIOError(e.errno, "Opening GPIO chip: " + e.strerror)
periphery.gpio.GPIOError: [Errno 13] Opening GPIO chip: Permission denied
>>>
')
There was an issue in aarch64 systems which lead to the first error, but it was resolved in 0.7.0 release:
$this->bbcode_second_pass_code('', 'Change Log
==========
0.7.0
-------
- Updated RPI_INFO to include RPi 4B
- Fixed pull up/down for Pi4 (issue 168)
- Fix spelling mistake in docstrings
- Tested and working on Raspbian Buster + Python 3.8.0b2
- Fix board detection for aarch64 (Issues 161 / 165)
- Fix checking mmap return value in c_gpio.c (issue 166)')
Could somebody make it?
Thanks
EDIT:
I've just realized that in my case the problem was that file /proc/cpuinfo lacks hardware, serial and revision information. I made it by editing the source code of the package (source/cpuinfo.c) and creating an auxiliary cpuinfo file to look into. May be this was your problem too, so I found in the Internet similar cases. I created another post
https://archlinuxarm.org/forum/viewtopic.php?f=65&t=14858 to resolve this issue.