Updated version of https://github.com/balena-io-playground/balena-rpi-gpio-sample-with-python

I’m trying to use GPIO on balenaOS with a RaspberryPi 3b.
I know that this example

is out of date because it has

ENV INITSYSTEM on in the Dockerfile.template.

Is there a more recent example?

Hey @jason10 - in the same repo you used is an open PR which seems to be more recent:

Maybe you could give this a try?

Nope. That container fails to build RPi.Gpio:

[Info] Starting build for sit-stand-desk-rpi3, user jason10
[Info] Dashboard link: balena dashboard
[Info] Building on arm04
[Info] Pulling previous images for caching purposes…
[Success] Successfully pulled cache images
[main] Step 1/6 : FROM balenalib/raspberrypi3-python:3.7-latest-build
[Info] Still Working…
[main] —> 4e81c3a169f3
[main] Step 2/6 : WORKDIR /usr/src/app
[main] —> Running in 1ef885e5a348
[main] Removing intermediate container 1ef885e5a348
[main] —> 92347fcea732
[main] Step 3/6 : COPY requirements.txt requirements.txt
[main] —> 56435568ff1d
[main] Step 4/6 : RUN pip install -r requirements.txt
[main] —> Running in 2bf273b7c82a
[main] Here are a few details about this Docker image (For more information please visit Balena base images - Balena Documentation):
[main] Architecture: ARM v7
[main] OS: Debian Bullseye
[main] Variant: build variant
[main] Default variable(s): UDEV=off
[main] The following software stack is preinstalled:
[main] Python v3.7.12, Pip v21.2.4, Setuptools v58.0.0
[main] Extra features:
[main] - Easy way to install packages with install_packages <package-name> command
[main] - Run anywhere with cross-build feature (for ARM only)
[main] - Keep the container idling with balena-idle command
[main] - Show base image details with balena-info command
[main] Collecting RPi.Gpio==0.6.5
[main] Downloading RPi.GPIO-0.6.5.tar.gz (26 kB)
[main] Using legacy ‘setup.py install’ for RPi.Gpio, since package ‘wheel’ is not installed.
[main] Installing collected packages: RPi.Gpio
[main] Running setup.py install for RPi.Gpio: started
[main] Running setup.py install for RPi.Gpio: finished with status ‘error’
[main] ERROR: Command errored out with exit status 1:
[main] command: /usr/local/bin/python3.7 -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/setup.py’"’"’; file=’"’"’/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-kbgs5g94/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/RPi.Gpio
[main] cwd: /tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/
[main] Complete output (70 lines):
[main] running install
[main] running build
[main] running build_py
[main] creating build
[main] creating build/lib.linux-armv7l-3.7
[main] creating build/lib.linux-armv7l-3.7/RPi
[main] copying RPi/init.py → build/lib.linux-armv7l-3.7/RPi
[main] creating build/lib.linux-armv7l-3.7/RPi/GPIO
[main] copying RPi/GPIO/init.py → build/lib.linux-armv7l-3.7/RPi/GPIO
[main] running build_ext
[main] building ‘RPi._GPIO’ extension
[main] creating build/temp.linux-armv7l-3.7
[main] creating build/temp.linux-armv7l-3.7/source
[main] gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c source/py_gpio.c -o build/temp.linux-armv7l-3.7/source/py_gpio.o
[main] gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c source/c_gpio.c -o build/temp.linux-armv7l-3.7/source/c_gpio.o
[main] gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c source/cpuinfo.c -o build/temp.linux-armv7l-3.7/source/cpuinfo.o
[main] gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c source/event_gpio.c -o build/temp.linux-armv7l-3.7/source/event_gpio.o
[main] gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c source/soft_pwm.c -o build/temp.linux-armv7l-3.7/source/soft_pwm.o
[main] gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c source/py_pwm.c -o build/temp.linux-armv7l-3.7/source/py_pwm.o
[main] gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c source/common.c -o build/temp.linux-armv7l-3.7/source/common.o
[main] gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c source/constants.c -o build/temp.linux-armv7l-3.7/source/constants.o
[main] gcc -pthread -shared build/temp.linux-armv7l-3.7/source/py_gpio.o build/temp.linux-armv7l-3.7/source/c_gpio.o build/temp.linux-armv7l-3.7/source/cpuinfo.o build/temp.linux-armv7l-3.7/source/event_gpio.o build/temp.linux-armv7l-3.7/source/soft_pwm.o build/temp.linux-armv7l-3.7/source/py_pwm.o build/temp.linux-armv7l-3.7/source/common.o build/temp.linux-armv7l-3.7/source/constants.o -L/usr/local/lib -lpython3.7m -o build/lib.linux-armv7l-3.7/RPi/_GPIO.cpython-37m-arm-linux-gnueabihf.so
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/soft_pwm.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/soft_pwm.c:28: multiple definition of threads'; build/temp.linux-armv7l-3.7/source/event_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/event_gpio.c:60: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/py_pwm.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:38: multiple definition of gpio_direction’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:38: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/py_pwm.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/py_pwm.h:23: multiple definition of PWMType'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/py_pwm.h:23: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/py_pwm.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:41: multiple definition of module_setup’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:41: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/py_pwm.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:40: multiple definition of setup_error'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:40: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/py_pwm.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:39: multiple definition of rpiinfo’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:39: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/py_pwm.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:37: multiple definition of pin_to_gpio'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:37: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/py_pwm.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:36: multiple definition of pin_to_gpio_rev3’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:36: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/py_pwm.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:35: multiple definition of pin_to_gpio_rev2'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:35: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/py_pwm.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:34: multiple definition of pin_to_gpio_rev1’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:34: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/py_pwm.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:33: multiple definition of gpio_mode'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:33: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/common.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:40: multiple definition of setup_error’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:40: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/common.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:41: multiple definition of module_setup'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:41: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/common.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:33: multiple definition of gpio_mode’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:33: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/common.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:39: multiple definition of rpiinfo'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:39: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/common.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:37: multiple definition of pin_to_gpio’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:37: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/common.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:38: multiple definition of gpio_direction'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:38: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/common.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:36: multiple definition of pin_to_gpio_rev3’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:36: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/common.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:35: multiple definition of pin_to_gpio_rev2'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:35: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/common.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:34: multiple definition of pin_to_gpio_rev1’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:34: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:26: multiple definition of high'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:26: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:27: multiple definition of low’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:27: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:29: multiple definition of output'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:29: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:28: multiple definition of input’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:28: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:30: multiple definition of pwm'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:30: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:31: multiple definition of serial’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:31: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:32: multiple definition of i2c'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:32: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:33: multiple definition of spi’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:33: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:34: multiple definition of unknown'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:34: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:35: multiple definition of board’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:35: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:36: multiple definition of bcm'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:36: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:37: multiple definition of pud_off’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:37: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:38: multiple definition of pud_up'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:38: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:39: multiple definition of pud_down’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:39: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:40: multiple definition of rising_edge'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:40: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:41: multiple definition of falling_edge’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:41: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:42: multiple definition of both_edge'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/constants.h:42: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:41: multiple definition of module_setup’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:41: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:40: multiple definition of setup_error'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:40: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:39: multiple definition of rpiinfo’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:39: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:38: multiple definition of gpio_direction'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:38: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:37: multiple definition of pin_to_gpio’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:37: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:36: multiple definition of pin_to_gpio_rev3'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:36: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:35: multiple definition of pin_to_gpio_rev2’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:35: first defined here
[main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:34: multiple definition of pin_to_gpio_rev1'; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:34: first defined here [main] /usr/bin/ld: build/temp.linux-armv7l-3.7/source/constants.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:33: multiple definition of gpio_mode’; build/temp.linux-armv7l-3.7/source/py_gpio.o:/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/source/common.h:33: first defined here
[main] collect2: error: ld returned 1 exit status
[main] error: command ‘gcc’ failed with exit status 1
[main] ----------------------------------------
[main]
[main] ERROR: Command errored out with exit status 1: /usr/local/bin/python3.7 -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/setup.py’"’"’; file=’"’"’/tmp/pip-install-fjsrsovo/rpi-gpio_3850bb486a7543779aef7ba92126e593/setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-kbgs5g94/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/RPi.Gpio Check the logs for full command output.
[main]
[main] WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
[main] You should consider upgrading via the ‘/usr/local/bin/python3.7 -m pip install --upgrade pip’ command.
[main]
[main] Removing intermediate container 2bf273b7c82a
[main] The command ‘/bin/sh -c pip install -r requirements.txt’ returned a non-zero code: 1
[Info] Uploading images
[Success] Successfully uploaded images
[Error] Some services failed to build:
[Error] Service: main
[Error] Error: The command ‘/bin/sh -c pip install -r requirements.txt’ returned a non-zero code: 1
[Info] Built on arm04
[Error] Not deploying release.
Remote build failed

Ah perfect, there is a build issue with later GCC versions, also reported already at RPi.GPIO:

Please use the PR I already showcased ( GitHub - balena-io-playground/balena-rpi-gpio-sample-with-python at balenalib ) but before pushing, open the requirements.txt and change the line

RPi.Gpio==0.6.5

to

RPi.Gpio==0.7.1

and afterwards, try again.

Thanks @nmaas87

Does this work @jason10 ?

1 Like

Thanks @mpous and @nmaas87

Changing the version of RPi.Gpio worked for the build and then following the examples at RPi Relay Board - Waveshare Wiki led to the correct control of the relay board that I’m using.

Thanks again!
-Jason

1 Like

Thanks for confirming @jason10

@nmaas87 you rock!

1 Like

Thank Marc, I created a signed PR for the fix, maybe one can acknowledge it?

Approved the PR @nmaas87 thanks for pushing this :slight_smile:

1 Like