Maybe gpiozero is the only option for Raspberry Pi 5?
gpiozero
import gpiozero, time led = gpiozero.LED(4) led.on() time.sleep(1) led.off()