Nrgpio python command not running

Hello,
I wanted to update my systems from the legacy Bullseye distro to the new Bookworm, however I've got this issue, which has some strange behaviour - when I use the gpio node, i get the error:
"nrgpio python command not running".
The actual gpio sometimes changes its state, sometimes not. Tried both the 32 bit and 64 bit versions of system, but same result. When I use legacy Bullseye, it works. Probably it has something to do with the gpio changes in Bookworm, but I'm surprised, that I did not find anyone else with this issue yet.

tested on fresh updated installation:
NR: 4.0.2
node.js: 20.16.0
npm: 10.8.2
latest Raspbian Bookworm

There have been quite a few posts over gpio issues.

I've not tried it but

says it works with Bookworm

1 Like

Thank you, I will definitely consider using this nodes.
But it would be much easier to stay with the current nodes ... so I am interested if this problem is only on my side, or if it is a bug in node, which happens to other users.

Everybody has the same problems.
It's due to changes by Raspberry Pi

1 Like

So should I raise an issue? I've not found an issue about it, but it is already half year since Bookworm release ... or does it mean that the official nodes are now deprecated and are not gonna be updated anymore?

I suggest trying the alternative node I linked to and see how that works for you.

Not many people are using Pi5 with Bookworm and wanting to access GPIO

The core nodes work fine on all previous versions of Pi using Bullseye so that is what the vast majority are continuing to use

I thought that the bookworm issue had been addressed a little while ago by @dceejay.

I don't have any recollection of that happening
but I'm getting old now :slight_smile:

I forgot to mention, that Im using RPi 4 ... should it work there?
I will try the suggested nodes, but it will be harder to deploy to all machines that Im using.

RPI4 should be ok. Have you run
sudo apt update
sudo apt full-upgrade
to make sure all installed s/w is up to date.

Did you run
sudo rpi-update?
Don't do that!

Same here. In fact you are right, it is the problems with the Pi5 that I was thinking of. There should not be issues with a 4 with Bookworm.

@mima232 also check in Manage Palette that all your nodes are at the latest version, and update any that are not up to date.

I believe that it's Bookworm that is the problem as it was the OS that introduced the fundamental changes to the way the gpio pins work

AFAIK, you have to run Bookworm on the Pi5 but if you run any other Pi under Bullseye (or older) then that will work

This is what I think - not fully tested

If you downgrade the OS to Bullseye, then the standard gpio nodes should work

I am sure I saw a thread that said that it was ok on a pi4, but I can't find that now, so you are very likely correct. I haven't got a spare pi to play with at the moment, so can't easily test it.

Indeed I’m old enough that I can’t remember what conclusion I came to ! ISTR that it can be made to work as there was an lgpio library that made it backwards compatible but that wasn’t available (or needed) on earlier versions so trying to fix it for one would break all the others etc unless you started doing ugly “if this hardware then” hacks.

Do you believe that bookworm on a pi4 should be ok?

Yes, the system I've tested on is freshly installed, nevertheless I just did the update and full-upgrade, but nothing changed. I did NOT the rpi-update.
Due to fresh install, the node should be at latest version, I've checked the Manage Palette and it is at the latest 2.0.6 version.
Strange thing is, that the node sometimes work, sometimes not, and it still prints that error message.

Yes, I could use the Bullseye distro ... I am using it at all my stations now, but there was a requirement for update ... do you know how long will be Bullseye supported?

I don't think legacy versions are supported at all, though I may be wrong.

This may be a foolish question but what exactly is the nrgpio python command?

Is it part of the OS or installed with the Node-red Pi nodes?

Node page says:
A set of Node-RED nodes to interact with Pi GPIO using the RPi.GPIO python library that is part of Raspbian.

OK I found nrgpio.py at https://github.com/node-red/node-red-nodes/blob/master/hardware/PiGpio/nrgpio.py
It has

# Import library functions we need
import RPi.GPIO as GPIO

According to
https://forums.raspberrypi.com/viewtopic.php?p=2160578, the rpi-lgpio library is a drop-in replacement for rpi.gpio and allows code that imports RPi.GPIO to work.

They say to install it thus

sudo apt remove python3-rpi.gpio
pip3 install rpi-lgpio

but I found (on a Pi 4 running Bookworm) that python3-rpi.gpio is not installed and I had to
sudo apt install python3-rpi-lgpio

Unfortunately I have nothing to plug in to the GPIO pins so I can't test if this works for Node-red. I expect other people have already tested this?

Does the Node-red install script go ahead and install the RPi nodes even if this library is not available? Should it check?