"This module can only be run on a Raspberry Pi" error when using RPi.GPIO on Raspberry Pi 4b.
This error was caused by the default RPi.GPIO version installed with:
python3 -m pip install RPi.GPIO
This command seems to install a version which is incompatible with PI 4b (Version 0.5.0). You can fix this error by typing:
python3 -m pip install RPi.GPIO==0.7.0
This was on a clean installation of Python3 and Raspbian using only the recommended installation commands found online.
I had already run apt-get update and apt-get upgrade and couldn't find any answers containing this solution after some searching around. Hopefully, this will save some time for somebody else.
Let me know if I missed the solution elsewhere or if I created this problem somehow.
Solved with the above.
There may be a more up to date version by the time you read this.