milaq / rpi-rf

Sending and receiving 433MHz signals with cheap GPIO RF modules on a Raspberry Pi
BSD 3-Clause "New" or "Revised" License
503 stars 179 forks source link

RPI 4 installation not working #57

Open myroom opened 3 years ago

myroom commented 3 years ago

I am unable to install this library like usual using pip3 install rpi-rf. Everything was updated via apt-get prior to installation.

System: HASSIO Raspberry Pi 4 python3 --version: Python 3.8.8

➜ ~ pip3 install rpi-rf Collecting rpi-rf Using cached rpi_rf-0.9.7-py3-none-any.whl (7.4 kB) Collecting RPi.GPIO Using cached RPi.GPIO-0.7.0.tar.gz (30 kB) Using legacy 'setup.py install' for RPi.GPIO, since package 'wheel' is not installed. Installing collected packages: RPi.GPIO, rpi-rf Running setup.py install for RPi.GPIO ... 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-izinf4wv/rpi-gpio_5bd48e3eebb8478784dbc3c77164ece7/setup.py'"'"'; file='"'"'/tmp/pip-install-izinf4wv/rpi-gpio_5bd48e3eebb8478784dbc3c77164ece7/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-e7_x1af0/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python3.8/RPi.GPIO cwd: /tmp/pip-install-izinf4wv/rpi-gpio_5bd48e3eebb8478784dbc3c77164ece7/ Complete output (19 lines): running install running build running build_py creating build creating build/lib.linux-aarch64-3.8 creating build/lib.linux-aarch64-3.8/RPi copying RPi/init.py -> build/lib.linux-aarch64-3.8/RPi creating build/lib.linux-aarch64-3.8/RPi/GPIO copying RPi/GPIO/init.py -> build/lib.linux-aarch64-3.8/RPi/GPIO running build_ext building 'RPi._GPIO' extension creating build/temp.linux-aarch64-3.8 creating build/temp.linux-aarch64-3.8/source gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -g -fno-semantic-interposition -g -fno-semantic-interposition -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.8 -c source/py_gpio.c -o build/temp.linux-aarch64-3.8/source/py_gpio.o source/py_gpio.c:23:10: fatal error: Python.h: No such file or directory 23 | #include "Python.h" | ^~~~~~ compilation terminated. error: command 'gcc' failed with exit status 1

ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-izinf4wv/rpi-gpio_5bd48e3eebb8478784dbc3c77164ece7/setup.py'"'"'; file='"'"'/tmp/pip-install-izinf4wv/rpi-gpio_5bd48e3eebb8478784dbc3c77164ece7/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-e7_x1af0/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python3.8/RPi.GPIO Check the logs for full command output.

xairoo commented 2 years ago

Try this:

export CFLAGS=-fcommon
pip3 install RPi.GPIO

Worked for me.