Cannot uninstall `python3-rpi.gpio`, missing 'debpython`

Required Information

  • DietPi version | 8.16.2
  • SBC model | RPi4 B

Additional Information

  • Software title | python3-rpi.gpio
  • Bug report ID | 19ca1405-8bd8-4e11-86d6-c577e15b2def
  • Python 3.11, installed myself

I’m trying to use an NFC HAT and to that end installed the python3-rpi.gpio package via dietpi-software but it did not install correctly and now I cannot uninstall with any method I tried so far.

Also, anything involving apt doesn’t work now, including dietpi-update, as the broken package makes dpkg always exit with an error.

Reading package lists...
Building dependency tree...
Reading state information...
python3-rpi.gpio is already the newest version (0.7.0-0.2+b2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python3-rpi.gpio (0.7.0-0.2+b2) ...
Traceback (most recent call last):
  File "/usr/bin/py3compile", line 34, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
ModuleNotFoundError: No module named 'debpython'
dpkg: error processing package python3-rpi.gpio (--configure):
 installed python3-rpi.gpio package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I cannot find any helpful information on debpython. How could I resolve this?

probably your python version did not fit to the version of python3-rpi.gpio pulled from Debian repository.

You could try to purge python3-rpi.gpio

apt purge python3-rpi.gpio