I wanted to control my Raspberry Pi 4 GPIO using a Python library given by the
raspberry-gpio-python project over at sourceforge.
After looking around I found an AUR package
python-raspberry-gpio which had that exact upstream.
yay -S python-raspberry-gpio I noticed it used pacman to perform the download and install instead of yay, as the package was in the official repos.
The problem is when trying to import the python package named
RPi.GPIO I get:
$ python Python 3.8.5 (default, Sep 5 2020, 17:18:53) [GCC 10.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import RPi Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'RPi'
The reason why this happens is quite simple, when installing the package
python-raspberry-gpio from the official repos I noticed that the package is installed over at
/lib/python3.7/site-packages instead of being installed in
/lib/python3.8/site-packages where it’s actually reachable by packages using Python on my system.
As a workaround I tried copying the files from
/lib/python3.8/site-packages but it didn’t work.
As a second workaround I tried downloading the AUR package by running
yay --aur python-raspberry-gpio to ignore the offical repos, but I’m running into the following compiling issue:
collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1 ==> ERROR: A failure occurred in package(). Aborting... error making: python-raspberry-gpio
Obviously I would prefer to use the official repos rather than using the AUR, so if this package could be updated from Python 3.7 to Python 3.8, which I suspect is easy as there’s barely any difference between the two, that would be great.
Thanks in advance!