Hello, DietPi community. I hope everyone is doing well.
Firstly, let me say that my experience with DietPi has been much more enjoyable than with Raspbian. This operating system is awesome! Thank you!
I am contacting you today because I ran into some trouble with NodeRED. Don’t worry, NodeRED installs and works just fine. However, when I try to install the node package from the palette manager that lets me use the GPIO pins on the Raspberry Pi (RPI 3 in this case), the installation process is unsuccessful. Let me elaborate. I chose the node package called “node-red-node-pi-gpio” since it has the most downloads. However, “node-red-node-pi-gpiod” is also recommended. You cannot simply download “node-red-node-pi-gpio” from the palette manager and expect it to work - there is some additional setup required by entering commands in the terminal as per the instalation instructions. Perhaps these terminal commands work on most other operating systems for the Raspberry Pi, but they do not work on DietPi. I am hoping we can work through them together. I got an error message on the second command specifically - ImportError: No module named setuptools. Thank you.
Respect and gratitude,
Krisberg
Hi,
I did a test installation on my RPi3B+ running Debian Bullseye 32bit and installation was running without issues. I did following
- dietpi-software install 122
- cd /mnt/dietpi_userdata/node-red/
- npm i node-red-node-pi-gpio
The package is available afterwards
root@DietPi3:/mnt/dietpi_userdata/node-red# npm list
node-red@ /mnt/dietpi_userdata/node-red
├── node-red-node-pi-gpio@1.2.3
└── node-red@2.0.6
root@DietPi3:/mnt/dietpi_userdata/node-red#
Did you changed into sub directory /mnt/dietpi_userdata/node-red before running installation of node-red-node-pi-gpio package?
Hello Joulinar. Thank you for your quick reply.
Forgive me if I was not clear. Installing the node package called “node-red-node-pi-gpio” isn’t the issue exactly. Installing it from the palette manager or with your method directly from the terminal both install the node package and they are made available in NodeRED. However, just because they are available in NodeRED, doesn’t mean that they are working. In addition to installing this node package, you must also use these terminal commands to truly complete the installation process, as per its installation instructions.
sudo apt-get install python-pip python-dev
sudo pip install RPi.GPIO
sudo addgroup gpio
sudo chown root:gpio /dev/gpiomem
sudo adduser $USER gpio
echo 'KERNEL=="gpiomem", NAME="%k", GROUP="gpio", MODE="0660"' | sudo tee /etc/udev/rules.d/45-gpio.rules
sudo udevadm control --reload-rules && sudo udevadm trigger
I got the error message “ImportError: No module named setuptools” on the second command. I was able to solve this error by, well, installing so-called “setuptools” and the nodes that control the GPIO pins on the Raspberry Pi are now actually controlling the GPIO pins. So, an additional line at the beginning is needed from the instructions provided, like this:
sudo sudo apt-get install -y python-setuptools
sudo apt-get install python-pip python-dev
sudo pip install RPi.GPIO
sudo addgroup gpio
sudo chown root:gpio /dev/gpiomem
sudo adduser $USER gpio
echo 'KERNEL=="gpiomem", NAME="%k", GROUP="gpio", MODE="0660"' | sudo tee /etc/udev/rules.d/45-gpio.rules
sudo udevadm control --reload-rules && sudo udevadm trigger
This page from StackOverflow was useful. Thanks again Joulinar!
Respect and Gratitude,
Krisberg
ah ok. probably I misunderstood you question. Good you solved it now.