Trouble installing RPi.GPIO

Hello!

I'm building a travel router with OpenWRT on a spare Pi 3B+ and I want to add an SSD1306 based oled display plus a shutdown button but both of them require the RPi.GPIO library.

I've installed all of the Python dependancies but I keep getting this error when I try to install the RPi.GPIO Python library.

[root@OpenWrt:~# pip install RPi.GPIO
Collecting RPi.GPIO
  Downloading RPi.GPIO-0.7.1.tar.gz (29 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: RPi.GPIO
  error: subprocess-exited-with-error
  
  × Building wheel for RPi.GPIO (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Building wheel for RPi.GPIO (pyproject.toml) ... error
  ERROR: Failed building wheel for RPi.GPIO
Failed to build RPi.GPIO
ERROR: Could not build wheels for RPi.GPIO, which is required to install pyproject.toml-based projects

Any idea what I'm doing wrong?

Update, based on this thread I've tried to install the following:

opkg update
opkg install python3 python3-pip
opkg install luci-ssl-openssl curl ca-bundle #error - opkg_install_cmd: Cannot install package luci-ssl-openssl.
pip install virtualenv	
opkg install python3-dev
opkg install gcc
pip install --upgrade pip

But I'm still unable to install RPi.GPIO using pip or pip3

root@OpenWrt:~# pip install RPi.GPIO
Collecting RPi.GPIO
  Using cached RPi.GPIO-0.7.1.tar.gz (29 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: RPi.GPIO
  error: subprocess-exited-with-error
  
  × Building wheel for RPi.GPIO (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Building wheel for RPi.GPIO (pyproject.toml) ... error
  ERROR: Failed building wheel for RPi.GPIO
Failed to build RPi.GPIO
ERROR: Could not build wheels for RPi.GPIO, which is required to install pyproject.toml-based projects


root@OpenWrt:~# pip3 install RPi.GPIO

Collecting RPi.GPIO
  Using cached RPi.GPIO-0.7.1.tar.gz (29 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: RPi.GPIO
  error: subprocess-exited-with-error
  
  × Building wheel for RPi.GPIO (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Building wheel for RPi.GPIO (pyproject.toml) ... error
  ERROR: Failed building wheel for RPi.GPIO
Failed to build RPi.GPIO
ERROR: Could not build wheels for RPi.GPIO, which is required to install pyproject.toml-based projects

Update: I've given up trying to use this library on the Pi and use an ESP8266 as a serial to i2c bridge which works well. Check out my write up here -> https://tristam.ie/2023/671/