I’ve got a Pi4 that is set up as an OSMC media centre. I want to be able to run a Python script at startup to control a PWM fan in the case. I have had this running previously but I’ve recently had to re-install OSMC after the SD card got corrupted. Since the script I want to run controls the fan via GPIO I am first trying to run:
$ sudo pip install RPi.GPIO
This fails with an error message shown in the stdout and stderr output shown below. I’m assuming that something is missing somewhere. Can anyone help to identify what this might be?
Collecting RPi.GPIO
Using cached RPi.GPIO-0.7.1.tar.gz (29 kB)
Building wheels for collected packages: RPi.GPIO
Building wheel for RPi.GPIO (setup.py): started
Building wheel for RPi.GPIO (setup.py): finished with status ‘error’
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-qy2halt7/rpi-gpio_956c946ef83d4ae3b05670a8dcf9ba1c/setup.py’“'”‘; file=’“'”‘/tmp/pip-install-qy2halt7/rpi-gpio_956c946ef83d4ae3b05670a8dcf9ba1c/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ bdist_wheel -d /tmp/pip-wheel-xtx18c9v
cwd: /tmp/pip-install-qy2halt7/rpi-gpio_956c946ef83d4ae3b05670a8dcf9ba1c/
Complete output (15 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-aarch64-3.9
creating build/lib.linux-aarch64-3.9/RPi
copying RPi/init.py → build/lib.linux-aarch64-3.9/RPi
creating build/lib.linux-aarch64-3.9/RPi/GPIO
copying RPi/GPIO/init.py → build/lib.linux-aarch64-3.9/RPi/GPIO
running build_ext
building ‘RPi._GPIO’ extension
creating build/temp.linux-aarch64-3.9
creating build/temp.linux-aarch64-3.9/source
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/reproducible-path/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/reproducible-path/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c source/c_gpio.c -o build/temp.linux-aarch64-3.9/source/c_gpio.o
error: command ‘arm-linux-gnueabihf-gcc’ failed: No such file or directory
ERROR: Failed building wheel for RPi.GPIO
Running setup.py clean for RPi.GPIO
Failed to build RPi.GPIO
Installing collected packages: RPi.GPIO
Running setup.py install for RPi.GPIO: started
Running setup.py install for RPi.GPIO: finished with status ‘error’
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-qy2halt7/rpi-gpio_956c946ef83d4ae3b05670a8dcf9ba1c/setup.py’“'”‘; file=’“'”‘/tmp/pip-install-qy2halt7/rpi-gpio_956c946ef83d4ae3b05670a8dcf9ba1c/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ install --record /tmp/pip-record-hvgiggqu/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/RPi.GPIO
cwd: /tmp/pip-install-qy2halt7/rpi-gpio_956c946ef83d4ae3b05670a8dcf9ba1c/
Complete output (15 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-aarch64-3.9
creating build/lib.linux-aarch64-3.9/RPi
copying RPi/init.py → build/lib.linux-aarch64-3.9/RPi
creating build/lib.linux-aarch64-3.9/RPi/GPIO
copying RPi/GPIO/init.py → build/lib.linux-aarch64-3.9/RPi/GPIO
running build_ext
building ‘RPi._GPIO’ extension
creating build/temp.linux-aarch64-3.9
creating build/temp.linux-aarch64-3.9/source
arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/reproducible-path/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/reproducible-path/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c source/c_gpio.c -o build/temp.linux-aarch64-3.9/source/c_gpio.o
error: command ‘arm-linux-gnueabihf-gcc’ failed: No such file or directory
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-qy2halt7/rpi-gpio_956c946ef83d4ae3b05670a8dcf9ba1c/setup.py’“'”‘; file=’“'”‘/tmp/pip-install-qy2halt7/rpi-gpio_956c946ef83d4ae3b05670a8dcf9ba1c/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ install --record /tmp/pip-record-hvgiggqu/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/RPi.GPIO Check the logs for full command output.