Yesterday everything was working fine, but today I ran the same code and I am getting the following error even though nothing has physically changed:

test3.py:8: RuntimeWarning: A physical pull up resistor is fitted on this channel!
  GPIO.setup(2, GPIO.OUT)
test3.py:9: RuntimeWarning: A physical pull up resistor is fitted on this channel!
  GPIO.setup(3, GPIO.OUT)

The code I am running is to operate a relay:

import RPi.GPIO as GPIO
from time import sleep

# The script as below using BCM GPIO 00..nn numbers

# Set relay pins as output
GPIO.setup(2, GPIO.OUT)
GPIO.setup(3, GPIO.OUT)
GPIO.setup(4, GPIO.OUT)
GPIO.setup(17, GPIO.OUT)

# Time to sleep between operations in the main loop
SleepTimeS = 0.5

# Main Loop
        while (True):

            # Turn all relays ON
            GPIO.output(2, GPIO.HIGH)
            GPIO.output(3, GPIO.HIGH)
            GPIO.output(4, GPIO.HIGH)
            GPIO.output(17, GPIO.HIGH)
            # Sleep for 5 seconds
            # Turn all relays OFF
            GPIO.output(2, GPIO.LOW)
            GPIO.output(3, GPIO.LOW)
            GPIO.output(4, GPIO.LOW)
            GPIO.output(17, GPIO.LOW)
            # Sleep for 5 seconds

# End program cleanly with keyboard
except KeyboardInterrupt:
    print "Good bye!"

Any ideas on how to fix this? I tried adding pull_up_down=GPIO.PUD_DOWNbut I just get the same error.

  • The "warning" seems quite clear; these pins are intended for I²C and have 1.8kΩ pullups installed. They can still be used for active low circuitry. Maybe RPi.GPIO just got updated to state the obvious.
    – Milliways
    Apr 29, 2017 at 10:55
  • I was playing with code yesterday so maybe that triggered something? I'm trying a fresh install to see, but yes, it could have been updated to state the obvious. It doesn't effect the operation, just sets off my OCD.
    – CJ0206
    Apr 29, 2017 at 11:15
  • This warning also happens with inputs if you turn on the internal pullup: GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP) If you're doing that, just let it use the external one that's there anyway: GPIO.setup(3, GPIO.IN) May 6, 2021 at 3:42

2 Answers 2


You have a number of choices.

  • ignore the warning
  • switch RPi.GPIO warnings off (see its documentation)
  • don't use GPIO 2/3 (pins 3/5) which have the hard-wired pull-ups
  • If it happens again I think I will just turn off the warnings, thank you for your suggestions.
    – CJ0206
    Apr 29, 2017 at 12:18
  • 4th option: use the physical pullups instead of the software ones?! What are the specs of the hardware pullups?
    – JPT
    Sep 30, 2020 at 18:08
  • All the GPIO were being used as outputs in the questioner's script. Pulls are normally only used for inputs. The external pull-ups on GPIO2/3 are both 1k8 in value.
    – joan
    Sep 30, 2020 at 19:44

A fresh install of raspbian has fixed the issue, whatever I tinkered with yesterday must of activated the pull up resistors.

  • I'm afraid that is wrong. The hard-wired resistors are ALWAYS enabled.
    – joan
    Apr 29, 2017 at 12:18
  • Strange how its reacted... I made sure to update/upgrade/rpi-update before testing.
    – CJ0206
    Apr 29, 2017 at 12:20
  • You can see the resistors on the circuit board next to pins 3 and 5. Perhaps the fresh install has pre-installed an older version of RPi.GPIO. I don't know when those particular warnings were introduced.
    – joan
    Apr 29, 2017 at 12:26
  • I thought they work using pull_up_down=GPIO.PUD_UP so thanks for the info @joan :)
    – CJ0206
    Apr 29, 2017 at 12:35
  • Each GPIO also has an internal pull-up to 3V3 and pull-down to ground which can be set with software. I.e. each GPIO may have an internal pull-up, pull-down, or neither enabled.
    – joan
    Apr 29, 2017 at 12:51

Your Answer

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

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