Fail to Install RPi.GPIO

Hey there,

I fail to install the RPi.GPIO on my RPi 1 Rev. B with the latest OSMC.

I’ll do this steps:

  1. sudo apt-get update
  2. sudo apt-get install python-setuptools
  3. sudo apt-get install python-pip
  4. sudo pip install wheel
  5. sudo pip install rpi.gpio

But I’ll get the following errors…

Blockquote
osmc@osmc_kueche:~$ sudo pip install rpi.gpio
Collecting rpi.gpio
Using cached https://files.pythonhosted.org/packages/af/2f/407b6e4cc8a0bdf434825a160bba1807991886b63cce16a5f1a6e1f24cdf/RPi.GPIO-0.6.5.tar.gz
Building wheels for collected packages: rpi.gpio
Running setup.py bdist_wheel for rpi.gpio … error
Complete output from command /usr/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-4kYVmB/rpi.gpio/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/tmp2hiNospip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv6l-2.7
creating build/lib.linux-armv6l-2.7/RPi
copying RPi/init.py → build/lib.linux-armv6l-2.7/RPi
creating build/lib.linux-armv6l-2.7/RPi/GPIO
copying RPi/GPIO/init.py → build/lib.linux-armv6l-2.7/RPi/GPIO
running build_ext
building ‘RPi._GPIO’ extension
creating build/temp.linux-armv6l-2.7
creating build/temp.linux-armv6l-2.7/source
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-Ub3vap/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv6l-2.7/source/py_gpio.o
unable to execute ‘arm-linux-gnueabihf-gcc’: No such file or directory
error: command ‘arm-linux-gnueabihf-gcc’ failed with exit status 1


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 … error
Complete output from command /usr/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-4kYVmB/rpi.gpio/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-j_TW7_-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-armv6l-2.7
creating build/lib.linux-armv6l-2.7/RPi
copying RPi/init.py → build/lib.linux-armv6l-2.7/RPi
creating build/lib.linux-armv6l-2.7/RPi/GPIO
copying RPi/GPIO/init.py → build/lib.linux-armv6l-2.7/RPi/GPIO
running build_ext
building ‘RPi._GPIO’ extension
creating build/temp.linux-armv6l-2.7
creating build/temp.linux-armv6l-2.7/source
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-Ub3vap/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv6l-2.7/source/py_gpio.o
unable to execute ‘arm-linux-gnueabihf-gcc’: No such file or directory
error: command ‘arm-linux-gnueabihf-gcc’ failed with exit status 1

----------------------------------------

Command “/usr/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-4kYVmB/rpi.gpio/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-j_TW7_-record/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-build-4kYVmB/rpi.gpio/

What went wrong??`

See GPIO control - need some help - #4 by sam_nazarko

I’ll get the same error again…
osmc@osmc:~$ sudo pip install rpi.gpio
Collecting rpi.gpio
Downloading https://files.pythonhosted.org/packages/af/2f/407b6e4cc8a0bdf434825a160bba1807991886b63cce16a5f1a6e1f24cdf/RPi.GPIO-0.6.5.tar.gz
Building wheels for collected packages: rpi.gpio
Running setup.py bdist_wheel for rpi.gpio … error
Complete output from command /usr/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-VawcVX/rpi.gpio/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/tmphq2exxpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv6l-2.7
creating build/lib.linux-armv6l-2.7/RPi
copying RPi/init.py → build/lib.linux-armv6l-2.7/RPi
creating build/lib.linux-armv6l-2.7/RPi/GPIO
copying RPi/GPIO/init.py → build/lib.linux-armv6l-2.7/RPi/GPIO
running build_ext
building ‘RPi._GPIO’ extension
creating build/temp.linux-armv6l-2.7
creating build/temp.linux-armv6l-2.7/source
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-Ub3vap/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv6l-2.7/source/py_gpio.o
source/py_gpio.c:23:20: fatal error: Python.h: No such file or directory
#include “Python.h”
^
compilation terminated.
error: command ‘arm-linux-gnueabihf-gcc’ failed with exit status 1


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 … error
Complete output from command /usr/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-VawcVX/rpi.gpio/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-0AMQGf-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-armv6l-2.7
creating build/lib.linux-armv6l-2.7/RPi
copying RPi/init.py → build/lib.linux-armv6l-2.7/RPi
creating build/lib.linux-armv6l-2.7/RPi/GPIO
copying RPi/GPIO/init.py → build/lib.linux-armv6l-2.7/RPi/GPIO
running build_ext
building ‘RPi._GPIO’ extension
creating build/temp.linux-armv6l-2.7
creating build/temp.linux-armv6l-2.7/source
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-Ub3vap/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv6l-2.7/source/py_gpio.o
source/py_gpio.c:23:20: fatal error: Python.h: No such file or directory
#include “Python.h”
^
compilation terminated.
error: command ‘arm-linux-gnueabihf-gcc’ failed with exit status 1

----------------------------------------

Command “/usr/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-VawcVX/rpi.gpio/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-0AMQGf-record/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-build-VawcVX/rpi.gpio/

Doesn’t look like you set up the CC variables

Try sudo apt-get install python-dev and then trying again.

1 Like