RPI.GPIO Stopped Installing

Hey everyone! I’m having an issue building a Dockerfile that previously worked, but yesterday stopped working.

The problematic package seems to be RPi.GPIO. Here is a link to the dockerfile and I’ve pasted the error below. I’m not sure why this exact file used to work, but now doesn’t and I can’t quite figure out what the source of the error is. Any help is much appreciated!

[co2]               Running setup.py install for RPi.GPIO: started
[co2]               Running setup.py install for RPi.GPIO: finished with status 'error'
[co2]               ERROR: Command errored out with exit status 1:
[co2]                command: /usr/local/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/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-cylewgxe/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/RPi.GPIO
[co2]                    cwd: /tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/
[co2]               Complete output (87 lines):
[co2]               running install
[co2]               running build
[co2]               running build_py
[co2]               creating build
[co2]               creating build/lib.linux-armv6l-3.9
[co2]               creating build/lib.linux-armv6l-3.9/RPi
[co2]               copying RPi/__init__.py -> build/lib.linux-armv6l-3.9/RPi
[co2]               creating build/lib.linux-armv6l-3.9/RPi/GPIO
[co2]               copying RPi/GPIO/__init__.py -> build/lib.linux-armv6l-3.9/RPi/GPIO
[co2]               running build_ext
[co2]               building 'RPi._GPIO' extension
[co2]               creating build/temp.linux-armv6l-3.9
[co2]               creating build/temp.linux-armv6l-3.9/source
[co2]               gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.9 -c source/c_gpio.c -o build/temp.linux-armv6l-3.9/source/c_gpio.o
[co2]               gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.9 -c source/common.c -o build/temp.linux-armv6l-3.9/source/common.o
[co2]               gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.9 -c source/constants.c -o build/temp.linux-armv6l-3.9/source/constants.o
[co2]               gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.9 -c source/cpuinfo.c -o build/temp.linux-armv6l-3.9/source/cpuinfo.o
[co2]               gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.9 -c source/event_gpio.c -o build/temp.linux-armv6l-3.9/source/event_gpio.o
[co2]               gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.9 -c source/py_gpio.c -o build/temp.linux-armv6l-3.9/source/py_gpio.o
[co2]               source/py_gpio.c: In function ‘PyInit__GPIO’:
[co2]               source/py_gpio.c:1046:4: warning: ‘PyEval_ThreadsInitialized’ is deprecated [-Wdeprecated-declarations]
[co2]                1046 |    if (!PyEval_ThreadsInitialized())
[co2]                     |    ^~
[co2]               In file included from /usr/local/include/python3.9/Python.h:154,
[co2]                                from source/py_gpio.c:23:
[co2]               /usr/local/include/python3.9/ceval.h:129:36: note: declared here
[co2]                 129 | Py_DEPRECATED(3.9) PyAPI_FUNC(int) PyEval_ThreadsInitialized(void);
[co2]                     |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~
[co2]               source/py_gpio.c:1047:7: warning: ‘PyEval_InitThreads’ is deprecated [-Wdeprecated-declarations]
[co2]                1047 |       PyEval_InitThreads();
[co2]                     |       ^~~~~~~~~~~~~~~~~~
[co2]               In file included from /usr/local/include/python3.9/Python.h:154,
[co2]                                from source/py_gpio.c:23:
[co2]               /usr/local/include/python3.9/ceval.h:130:37: note: declared here
[co2]                 130 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
[co2]                     |                                     ^~~~~~~~~~~~~~~~~~
[co2]               gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.9 -c source/py_pwm.c -o build/temp.linux-armv6l-3.9/source/py_pwm.o
[co2]               gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.9 -c source/soft_pwm.c -o build/temp.linux-armv6l-3.9/source/soft_pwm.o
[co2]               gcc -pthread -shared build/temp.linux-armv6l-3.9/source/c_gpio.o build/temp.linux-armv6l-3.9/source/common.o build/temp.linux-armv6l-3.9/source/constants.o build/temp.linux-armv6l-3.9/source/cpuinfo.o build/temp.linux-armv6l-3.9/source/event_gpio.o build/temp.linux-armv6l-3.9/source/py_gpio.o build/temp.linux-armv6l-3.9/source/py_pwm.o build/temp.linux-armv6l-3.9/source/soft_pwm.o -L/usr/local/lib -o build/lib.linux-armv6l-3.9/RPi/_GPIO.cpython-39-arm-linux-gnueabihf.so
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:41: multiple definition of `module_setup'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:41: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:40: multiple definition of `setup_error'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:40: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:39: multiple definition of `rpiinfo'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:39: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:38: multiple definition of `gpio_direction'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:38: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:37: multiple definition of `pin_to_gpio'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:37: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:36: multiple definition of `pin_to_gpio_rev3'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:36: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:35: multiple definition of `pin_to_gpio_rev2'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:35: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:34: multiple definition of `pin_to_gpio_rev1'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:34: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:33: multiple definition of `gpio_mode'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:33: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:33: multiple definition of `gpio_mode'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:33: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:40: multiple definition of `setup_error'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:40: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:39: multiple definition of `rpiinfo'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:39: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:38: multiple definition of `gpio_direction'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:38: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:37: multiple definition of `pin_to_gpio'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:37: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:41: multiple definition of `module_setup'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:41: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:36: multiple definition of `pin_to_gpio_rev3'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:36: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:34: multiple definition of `pin_to_gpio_rev1'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:34: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:35: multiple definition of `pin_to_gpio_rev2'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:35: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:42: multiple definition of `both_edge'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:42: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:41: multiple definition of `falling_edge'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:41: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:40: multiple definition of `rising_edge'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:40: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:39: multiple definition of `pud_down'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:39: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:38: multiple definition of `pud_up'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:38: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:37: multiple definition of `pud_off'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:37: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:36: multiple definition of `bcm'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:36: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:35: multiple definition of `board'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:35: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:34: multiple definition of `unknown'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:34: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:33: multiple definition of `spi'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:33: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:32: multiple definition of `i2c'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:32: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:31: multiple definition of `serial'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:31: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:30: multiple definition of `pwm'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:30: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:29: multiple definition of `output'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:29: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:28: multiple definition of `input'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:28: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:27: multiple definition of `low'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:27: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:26: multiple definition of `high'; build/temp.linux-armv6l-3.9/source/constants.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/constants.h:26: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_pwm.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:38: multiple definition of `gpio_direction'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:38: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_pwm.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/py_pwm.h:23: multiple definition of `PWMType'; build/temp.linux-armv6l-3.9/source/py_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/py_pwm.h:23: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_pwm.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:41: multiple definition of `module_setup'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:41: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_pwm.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:40: multiple definition of `setup_error'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:40: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_pwm.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:39: multiple definition of `rpiinfo'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:39: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_pwm.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:37: multiple definition of `pin_to_gpio'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:37: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_pwm.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:36: multiple definition of `pin_to_gpio_rev3'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:36: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_pwm.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:35: multiple definition of `pin_to_gpio_rev2'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:35: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_pwm.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:34: multiple definition of `pin_to_gpio_rev1'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:34: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/py_pwm.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:33: multiple definition of `gpio_mode'; build/temp.linux-armv6l-3.9/source/common.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/common.h:33: first defined here
[co2]               /usr/bin/ld: build/temp.linux-armv6l-3.9/source/soft_pwm.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/soft_pwm.c:28: multiple definition of `threads'; build/temp.linux-armv6l-3.9/source/event_gpio.o:/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/source/event_gpio.c:60: first defined here
[co2]               collect2: error: ld returned 1 exit status
[co2]               error: command '/usr/bin/gcc' failed with exit code 1
[co2]               ----------------------------------------
[co2]           
[co2]           ERROR: Command errored out with exit status 1: /usr/local/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tfzh2no7/rpi-gpio_b44e2c45e9024ff2bc688aaf3e01f479/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-cylewgxe/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/RPi.GPIO Check the logs for full command output.
[co2]           
[co2]           Removing intermediate container e0374f2c7edc
[co2]           The command '/bin/sh -c pip install RPi.GPIO smbus adafruit-circuitpython-scd30 influxdb-client paho-mqtt requests gpsd-py3 adafruit-circuitpython-ina219 adafruit-circuitpython-lc709203f adafruit-circuitpython-dps310' returned a non-zero code: 1
[Info]          Uploading images

I guess building with the -python image without any tag will build it with Python 3.9 - as shown in the logs.

The current online version of RPi.GPIO (0.7.0) is from 2019: RPi.GPIO · PyPI

It could be that there is a problem with Python 3.9 - because there are a lot of Py_DEPRECATED(3.9) errors. I would try to use some lower version with that.

Or you try to manually build with one of the pre-release RPi.GPIO versions which fix those errors, see here: RPi.GPIO · PyPI (I would take the 0.7.1a4, probably you just need to specify with RPi.GPIO==0.7.1a4 for the pip install line, I guess… instead of just RPi.GPIO)

1 Like

Interesting. Yeah pinning to the PyPI version did indeed fix this. Thanks for pointing that out! I really appreciate it!

I guess I’m confused why it stopped working if this would have been an issue for a long time haha. Did the Balena base images get updated to 3.9 recently and that caused this error?

1 Like

From the Docker Hub page of the image, they updated it 4 days ago - 3.9 is actually the Python LTS version from last year (yesterday 3.10 was released) so it makes sense to have the image on a version close to the latest, or the latest. This is why its so important in all things Docker to use image version pinning, because otherwise things break - like on our case. Because you could still pin it to some other version, e.g. look at the Hub page:
https://hub.docker.com/r/balenalib/raspberry-pi-python

1 Like

Yeah makes sense. Thanks so much for your thoughtful responses! This seems like good motivation to pin my docker images down to specific versions I suppose haha.

2 Likes