1

I'm working through this tutorial, and it says to manually, and I mean manually, install RPi.GPIO:

cd /home/pi/Downloads
wget https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.11.tar.gz
sudo tar -zxvf RPi.GPIO-0.5.11.tar.gz
cd RPi.GPIO-0.5.11
sudo python3 setup.py install

I haven't worked with the GPIOs yet, so it seemed odd that I'd have to install, and quite manually no less, the seemingly official GPIO library/interface. I'm used to sudo apt-get foo, but this seems a little extreme given the intended audience of the Pi (childrens and tech-muggles).

Looking online, the official documentation doesn't say if it's included in Raspbian or not, but a Makezine article from 2014 says that it is included with Raspbian. There have been several new versions of the package since the article was published. Current version is 0.6.3.

Do I need to manually install a GPIO package? Is RPi.GPIO just the tutorial's author's favorite GPIO package? Did the Pi Zero not have the GPIO package in its distro for some period of time for some reason?

I'm working with a Raspberry Pi Zero W and the version of Raspbian called stretch: "2017-09-07-raspbian-stretch.zip".

1 Answer 1

4

You don't mention which Distro and OS you are using, but given your question and the linked tutorial, I am going to assume Raspbian and Python 3). you can confirm if the RPi.GPIO module is installed (which it likely is if you are using Raspbian) by doing the following.

From the terminal open Python3 REPL with the following command:

python3

then type:

import RPi.GPIO

If you don't get an error it is already installed.

IIRC early versions of Raspbian did not include the RPi.GPIO package by default.

4
  • It looks like RPi.GPIO and gpiozero are both included by default, on purpose, in Raspbian by the head honchos at Raspberry PI HQ. raspberrypi.org/blog/gpio-zero-update Commented Nov 8, 2017 at 0:48
  • @YetAnotherRandomUser They are now, but that was not always the case. Commented Nov 8, 2017 at 0:58
  • Which explains the plethora of questions regarding it not working. Seems it's been a default package for a few years now. Commented Nov 8, 2017 at 0:59
  • 1
    Yup, RPi.GPIO has was included by default early in Jessie I think (I don't think it was default in wheezy, but I'd have to spin one up to be sure). GPIO Zero got included by default mid-way through Jessie, and I'm pretty sure pigpio is installed by default these days too (as it's required by raspi-config for the remote GPIO setup).
    – Dave Jones
    Commented Nov 10, 2017 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.