I just purchased a Pi 2, and everytime I use "Import RPi.GPIO" in Python it returns an error that says RPi.GPIO can only be run on a Raspberry Pi, but I am running it on a Pi. I tried apt-get update and apt-get upgrade, but it still doesn't recognize the Pi. What can I do about this?

  • 1
    Is this a fresh install or did you copy the SD card from another Pi. Did you install RPi.GPIO yourself or did you use a pre-installed version? – joan Mar 10 '15 at 19:48
  • Did you custom compile a kernel? What version of RPI.GPIOS are you running. See this sourceforge.net/p/raspberry-gpio-python/tickets/84 for more info. I believe this will fix the problem sudo apt-get update $ sudo apt-get install python-rpi.gpio python3-rpi.gpio – Steve Robillard Mar 10 '15 at 20:33

The library had to be updated for raspberry 2 boards - I believe it is documented in "issue 95" which is listed on site : https://pypi.python.org/pypi/RPi.GPIO see also this forum post on raspberry site : http://www.raspberrypi.org/forums/viewtopic.php?f=28&t=99281

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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