[Pkg-raspi-maintainers] Bug#976118: python3-gpiozero: fails to work with the RPI 4 (on the Debian kernel)
Lucas Nussbaum
lucas at debian.org
Sun Nov 29 22:52:49 GMT 2020
Package: python3-gpiozero
Version: 1.4.1-1.1
Severity: normal
Dear Maintainer,
gpiozero fails to work with the Debian kernel (as opposed to the
raspberry pi foundation one).
With version 1.4.1, I get:
Traceback (most recent call last):
File "t2.py", line 4, in <module>
led = LED(4)
File "/usr/lib/python3/dist-packages/gpiozero/devices.py", line 95, in __call__
self = super(GPIOMeta, cls).__call__(*args, **kwargs)
File "/usr/lib/python3/dist-packages/gpiozero/output_devices.py", line 141, in __init__
pin, active_high, initial_value, pin_factory=pin_factory
File "/usr/lib/python3/dist-packages/gpiozero/output_devices.py", line 47, in __init__
super(OutputDevice, self).__init__(pin, pin_factory=pin_factory)
File "/usr/lib/python3/dist-packages/gpiozero/mixins.py", line 69, in __init__
super(SourceMixin, self).__init__(*args, **kwargs)
File "/usr/lib/python3/dist-packages/gpiozero/devices.py", line 375, in __init__
pin = self.pin_factory.pin(pin)
File "/usr/lib/python3/dist-packages/gpiozero/pins/pi.py", line 73, in pin
pin = self.pin_class(self, n)
File "/usr/lib/python3/dist-packages/gpiozero/pins/rpigpio.py", line 94, in __init__
super(RPiGPIOPin, self).__init__(factory, number)
File "/usr/lib/python3/dist-packages/gpiozero/pins/pi.py", line 241, in __init__
factory.pi_info.physical_pin(repr(self))
File "/usr/lib/python3/dist-packages/gpiozero/pins/__init__.py", line 130, in <lambda>
lambda self: self._get_pi_info(),
File "/usr/lib/python3/dist-packages/gpiozero/pins/pi.py", line 90, in _get_pi_info
self._info = pi_info(self._get_revision())
File "/usr/lib/python3/dist-packages/gpiozero/pins/local.py", line 67, in _get_revision
raise PinUnknownPi('unable to locate Pi revision in /proc/cpuinfo')
gpiozero.exc.PinUnknownPi: unable to locate Pi revision in /proc/cpuinfo
I tried upgrading to the current upstream git tree.
I run in another issue, which is caused by missing support in RPi.GPIO:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/gpiozero/pins/pi.py", line 109, in pin
pin = self.pins[n]
KeyError: 4
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "t2.py", line 4, in <module>
led = LED(4)
File "/usr/lib/python3/dist-packages/gpiozero/devices.py", line 131, in __call__
self = super(GPIOMeta, cls).__call__(*args, **kwargs)
File "/usr/lib/python3/dist-packages/gpiozero/output_devices.py", line 217, in __init__
pin, active_high, initial_value, pin_factory=pin_factory
File "/usr/lib/python3/dist-packages/gpiozero/output_devices.py", line 99, in __init__
super(OutputDevice, self).__init__(pin, pin_factory=pin_factory)
File "/usr/lib/python3/dist-packages/gpiozero/mixins.py", line 106, in __init__
super(SourceMixin, self).__init__(*args, **kwargs)
File "/usr/lib/python3/dist-packages/gpiozero/devices.py", line 545, in __init__
pin = self.pin_factory.pin(pin)
File "/usr/lib/python3/dist-packages/gpiozero/pins/pi.py", line 111, in pin
pin = self.pin_class(self, n)
File "/usr/lib/python3/dist-packages/gpiozero/pins/rpigpio.py", line 132, in __init__
GPIO.setup(self.number, GPIO.IN, self.GPIO_PULL_UPS[self._pull])
RuntimeError: Not running on a RPi!
That's due to missing support in RPi.GPIO (see #976114 and
https://sourceforge.net/p/raspberry-gpio-python/tickets/191/ ).
After fixing RPi.GPIO with the dirty patch I provided in the upstream ticket, gpiozero works fine.
However, gpiozero should also work without RPi.GPIO (see the native pin
factory in the code). Without RPi.GPIO, I get:
/usr/lib/python3/dist-packages/gpiozero/devices.py:289: PinFactoryFallback: Falling back from rpigpio: No module named 'RPi'
'Falling back from %s: %s' % (name, str(e))))
/usr/lib/python3/dist-packages/gpiozero/devices.py:289: PinFactoryFallback: Falling back from rpio: No module named 'RPIO'
'Falling back from %s: %s' % (name, str(e))))
/usr/lib/python3/dist-packages/gpiozero/devices.py:289: PinFactoryFallback: Falling back from pigpio: No module named 'pigpio'
'Falling back from %s: %s' % (name, str(e))))
/usr/lib/python3/dist-packages/gpiozero/devices.py:289: PinFactoryFallback: Falling back from native: [Errno 1] Operation not permitted
'Falling back from %s: %s' % (name, str(e))))
Traceback (most recent call last):
File "t2.py", line 4, in <module>
led = LED(4)
File "/usr/lib/python3/dist-packages/gpiozero/devices.py", line 131, in __call__
self = super(GPIOMeta, cls).__call__(*args, **kwargs)
File "/usr/lib/python3/dist-packages/gpiozero/output_devices.py", line 217, in __init__
pin, active_high, initial_value, pin_factory=pin_factory
File "/usr/lib/python3/dist-packages/gpiozero/output_devices.py", line 99, in __init__
super(OutputDevice, self).__init__(pin, pin_factory=pin_factory)
File "/usr/lib/python3/dist-packages/gpiozero/mixins.py", line 106, in __init__
super(SourceMixin, self).__init__(*args, **kwargs)
File "/usr/lib/python3/dist-packages/gpiozero/devices.py", line 536, in __init__
super(GPIODevice, self).__init__(**kwargs)
File "/usr/lib/python3/dist-packages/gpiozero/devices.py", line 250, in __init__
Device.pin_factory = Device._default_pin_factory()
File "/usr/lib/python3/dist-packages/gpiozero/devices.py", line 290, in _default_pin_factory
raise BadPinFactory('Unable to load any default pin factory!')
gpiozero.exc.BadPinFactory: Unable to load any default pin factory!
This is known upstream, and there's a PR in progress:
https://github.com/gpiozero/gpiozero/pull/900
Lucas
-- System Information:
Debian Release: 10.6
APT prefers stable
APT policy: (990, 'stable')
Architecture: arm64 (aarch64)
Kernel: Linux 5.8.0-0.bpo.2-arm64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_CRAP
Locale: LANG=en_DK.UTF-8, LC_CTYPE=C.UTF-8 (charmap=locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
UTF-8), LANGUAGE=en_DK.UTF-8 (charmap=locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages python3-gpiozero depends on:
ii python3 3.7.3-1
ii python3-rpi.gpio 0.7.0-0.2
python3-gpiozero recommends no packages.
Versions of packages python3-gpiozero suggests:
pn python-pigpio <none>
More information about the Pkg-raspi-maintainers
mailing list