Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#976118: python3-gpiozero: fails to work with the RPI 4 (on the Debian kernel)

118 views
Skip to first unread message

Lucas Nussbaum

unread,
Nov 29, 2020, 6:10:04 PM11/29/20
to
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>

Matthias Urlichs

unread,
Feb 11, 2022, 5:00:04 AM2/11/22
to
Hi,

Upstream appears to have merged the fix. Please consider upgrading this
package.

--
-- mit freundlichen Grüßen
--
-- Matthias Urlichs

matthias.vcf
OpenPGP_signature

Diederik de Haas

unread,
May 3, 2022, 10:10:04 AM5/3/22
to
On 11 Feb 2022 10:32:06 +0100 Matthias Urlichs <matt...@urlichs.de> wrote:
> Upstream appears to have merged the fix.

Do you have a link to that fix?

> Please consider upgrading this package.

The latest upstream tag is v1.6.2 which is available in Testing/Unstable.
Is the issue still present or is it fixed with that version?
signature.asc

Philippe SWARTVAGHER

unread,
May 27, 2022, 12:30:03 PM5/27/22
to
Control: fixed -1 1.6.2-1

Hello,

> The latest upstream tag is v1.6.2 which is available in Testing/Unstable.
> Is the issue still present or is it fixed with that version?

I just encountered the same problem with a Debian bullseye. When using
the package from testing, the bug doesn't appear anymore.

Could you consider backporting the package currently in testing into
bullseye-backports?

Philippe.

Daniel Teichmann

unread,
Oct 26, 2022, 7:21:24 AM10/26/22
to
Hello everyone,

Are there any news regarding the backports? :)

Backporting to bullseye would be so awesome!

--

DAS-NETZWERKTEAM
Daniel Teichmann

GnuPG Key ID 0x8100A778
mail: daniel.t...@das-netzwerkteam.de, http://das-netzwerkteam.de

OpenPGP_signature

Matthias Urlichs

unread,
Dec 30, 2022, 8:30:05 AM12/30/22
to
On 03.05.22 16:04, Diederik de Haas wrote:
> Do you have a link to that fix?

https://github.com/gpiozero/gpiozero/pull/929
matthias.vcf
OpenPGP_signature

Diederik de Haas

unread,
Dec 30, 2022, 9:10:04 AM12/30/22
to
On Friday, 30 December 2022 14:03:03 CET Matthias Urlichs wrote:
> > Do you have a link to that fix?
>
> https://github.com/gpiozero/gpiozero/pull/929

Thanks
signature.asc
0 new messages