Ubuntu Core Snap failing to build RPI GPIO
Please have a look at https://github.com/phylax2020/RPi.GPIO
remove_event_detect() may produce a memory access error - system exit
Unable to run using archlinux armv8
Update: I upgraded from Bullseye to Bookworm (with this as a guide), and everything continued working as it should. Possible packaging problem by Raspberry Pi?
regression: can't import RPi.GPIO on RPi model B
I tried the standard install command on my apple silicon macintosh. It didn't work because a header file called sys/epoll.h is missing from the system.A little research suggests that this header file belongs to Linux, not clear that it belongs to Macintosh. Here's the full output: % pip install RPi.GPIO Collecting RPi.GPIO Downloading RPi.GPIO-0.7.1.tar.gz (29 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: RPi.GPIO Building wheel for RPi.GPIO (setup.py) ... error...
Will this be fixed and published for easier update?
It seems /sys/class/gpio is only used for edge detection. It only appears in event_gpio.c. The immediate problem is that starting with kernel 6.5, BCM GPIO numbering in /sys/class/gpio doesn't start with 0 any more. It starts with 512 on my Raspberry Pi 2 B running Raspbian Bullseye with kernel 6.6.20+rpt-rpi-v7 but don't know if it is safe to hard code 512. Regardless of that, I created a quick fix which adds 512 to numbers when using /sys/class/gpio and increases size of buffers used for this....
RPi.GPIO stubs are on typeshed as of https://github.com/python/typeshed/pull/11345
No access to /dev/mem, how to change to /dev/gpiomem
Looks like /sys/class/gpio has been deprecated: https://www.thegoodpenguin.co.uk/blog/stop-using-sys-class-gpio-its-deprecated/ And now it's not present in the latest Ubuntu Server OS, which is what I'm running. Any plans to migrate away from /sys/class/gpio?
I am getting the same error as above, using RPi.GPIO 0.7.1 and Python 3.11. Is there any fix or workaround?
Provide bindings for non-RPi development
Due to lack of response, we ended up refactoring and using libgpiod. Thanks.
More info. It wasn't installing at all previously, but now it installs. When I try running GPIO.setup() as a user I get: RuntimeError: No access to /dev/mem. Try running as root! If I run as root, I get: RuntimeError: Mmap of GPIO registers failed
Plans to support Raspberry Pi 5
Thank you Emmanuel
I just get that this cant be installed on my windows system even thought I just want to have it install so I can do coding on my windows system and known that it will work for my PI systems
Adding type stubs would help teach linting and type-checking tools about possible imports, symbols and class/methods definitions. See https://peps.python.org/pep-0561/#specification If the maintainer(s) of this project does not want to provide and maintain type-stubs, you can create your own package and distribute it on PyPI. Or request and/or add it to https://github.com/python/typeshed . This also relates to the following stub-request Pylance issue: https://github.com/microsoft/python-type-stu...
Support pyproject.toml-based installation
I found a 2 year old post that says this library is not able to be compiled on windows.
Here is the screen cap of Visual C++ 14.) or greater installed
pip install error on windows
Unable to build with gcc 11 - Segmentation fault
Hello, I ended up migrating to gpiod, where things work out of the box. Best msaimper
RPi.GPIO 0.7.1 still acts on /sys/class/gpio/ ?
Just seems like a bad bug that I can't even watch for a change while only reading a pin that it causes failures elsewhere.
I would loop back pin 12 to another spare pin on your RPi using a 1k resistor and monitor that pin instead. It isn't possible to set up events for an output channel.
PTT = push to talk. it raises one of the GPIO pins to high which is connected to my ham radio to key up the mic for transmit out RF. I'm trying to monitor direwolf when it raises the PTT GPIO pin There is also an RX GPIO Pin as well that I want to monitor at the same time Ultimately I'm trying to monitor when my ham radio does a TX and RX via the GPIO pins that direwolf uses.
Is the PTT an output from direwolf?
I'm trying to monitor the PTT being set high from python.
Rather than a software fix, would it not be easier in this case to connect your PTT to a second input pin as well and use that?
Rather than a software fix, would it not be easier in this case to connect your PTT to a second input pin and use that?
Using add_event_detect() prevents other apps from using the GPIO pins.
Missing "Python.h"
Within a single Python program, there should be little issue, but would other processes or external hardware always see bits tested and changed in the same order? I no longer have an issue of wrong GPIO changing among simultaneous C++ & Python programs since I corrected a C++ code mistake in using the special set & clear addresses in the gpio_map. I had seen some examples of C GPIO code using __sync_synchronize() so I was thinking there was a concern. CPU behavior or overhead in Python might assure...
Shouldn't __sync_synchronize() be used after writes and before IO reads ?
CPython effectively operates as a single thread (i.e. it uses the GIL) so this is unlikely to be a problem. Do you know of any issues that the lack of __sync_synchronize() causes?
Support Radxa Zero
The radxa zero is not a Raspberry Pi and uses a completely different SOC so it will never be supported by this library.
Installing package failed on PyCharm
RPi.GPIO is not designed to be compiled or run on Windows
Not running on a RPi! on Pi4B running AWS Greengrass
Looking at the code, it can be 99% be resolved by a small modification to run_py_callbacks(unsigned int gpio) by moving the code inside the if (cb->gpio == gpio) branch outside the loop, this would allow the callback to modify the callback linked list without crashing the loop. This would leave still a tiny chance of the callback getting called during the initial setup of the callbacks, getting into a race condition if I'm right, but I haven't looked at how the threading is set up yet. So a lock...
I've made the modifications to allow callbacks adding/removing callbacks, see attached files. I've moved performing the call backs to outside the loop, so the callback doesn't mess up the loop. Plus I've added a mutex so another thread cannot mess up the loop if the other thread is adding/removing callbacks. There's only one tiny risk during startup, since the polling thread is created/started when adding the first callback, in theory when that callback is called right away, it can add callbacks,...
This is part of Python itself, not RPi.GPIO. Have you got the Python development packages installed on your distro?
Missing "Python.h"
Solved. Adding the user that greengrass runs as to the group gpio fixed the issue.
I have learned a bit more. When I run commands in the cli as the greengrass user I get the errors. It definitely seems to be a hardware detection error that is happening but only when run a certain users.
Not running on a RPi! on Pi4B running AWS Greengrass
Shouldn't __sync_synchronize() be used after writes and before IO reads ?
Segfault when using callbacks
Update download files to the latest version
Make adding and removing event handlers (add_event_detect and remove_event_detect) thread safe.
Misidentifying board type
Fixed in 0.7.1
"Not running on a RPi" message from GPIO.setup(id, GPIO.IN) on new RPi4B
Fixed in 0.7.1
compilation warning on python 3.9 and gcc 10
Fixed in 0.7.1
Compilation Fails with Python 3.9
Fixed in 0.7.1
Compilation Fails with Python 3.9
Fixed in 0.7.1
64bit This module can only be run on a Raspberry Pi!
Fixed in 0.7.1
/proc/cpuinfo identification needs updates for RPi 4
Fixed in 0.7.1
Release 0.7.1
Added tag 0.7.1 for changeset f8d556afd9b0
This problem is caused by a change to the GCC 10 default options. I came across it while migrating my RaspberryPi's from Buster to the newly released Raspberry Pi OS BullsEye. Originally, the default was -fcommon but it has been changed to -fno-common. You can work around the problem by setting the CFLAGS environment variable. For example: export CFLAGS=-fcommon Alternatively, this problem can be fixed in source by changing setup.py as follows: setup(name = 'RPi.GPIO', version = '0.7.0', author =...
Agreed, would be great to promote this to a non alpha status as it was a bit freaky after dist-upgrade to fine rpi.GPIO wouldn't install, worked around with a pin to the alpha version, but would be great for folks to not have to do that.
Setting up an output should not always disable pulls
November now; Bullseye is released, with python 3.9 as default.. https://forums.raspberrypi.com/viewtopic.php?t=323289 Getting a non-alpha release out asap could be a good idea.
I use Raspberry Pi OS https://www.raspberrypi.com/software/ Funny, I found that python 2 runs, but not python3
Repo of what distro? Also, the upstream kernel is deprecating GPIO control via sysfs, so you might want to look into alternate Python solutions. This is the new world: https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
When will this reach an official repository. And where can I download the patch?
Support Radxa Zero
Installing package failed on PyCharm
Could you paste the output of tail -n 4 /proc/cpuinfo | grep -v ^Serial ?
I can confirm that it's fixed in 0.7.1a4 with Hardware : BCM2711 Revision : c03114 Model : Raspberry Pi 4 Model B Rev 1.4 It wasn't working with 0.7.0
Your Programm runs only once. Try it within a while loop: import time import RPi.GPIO as GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.OUT) GPIO.setup(27, GPIO.OUT) GPIO.setup(22, GPIO.OUT) GPIO.setup(16, GPIO.OUT) while True: GPIO.output(16, GPIO.HIGH) GPIO.output(17, GPIO.HIGH) GPIO.output(27, GPIO.HIGH) GPIO.output(22, GPIO.HIGH) time.sleep(2) GPIO.output(17, GPIO.LOW) GPIO.output(27, GPIO.LOW) GPIO.output(22, GPIO.LOW) time.sleep(2) GPIO.cleanup() https://www.tutori...
Your Programm runs only once. Try it within a while loop: import time import RPi.GPIO as GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.OUT) GPIO.setup(27, GPIO.OUT) GPIO.setup(22, GPIO.OUT) GPIO.setup(16, GPIO.OUT) while True: GPIO.output(16, GPIO.HIGH) GPIO.output(17, GPIO.HIGH) GPIO.output(27, GPIO.HIGH) GPIO.output(22, GPIO.HIGH) time.sleep(2) GPIO.output(17, GPIO.LOW) GPIO.output(27, GPIO.LOW) GPIO.output(22, GPIO.LOW) time.sleep(2) GPIO.cleanup()
Your Programm runs only once. Try it within a while loop: import time import RPi.GPIO as GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.OUT) GPIO.setup(27, GPIO.OUT) GPIO.setup(22, GPIO.OUT) GPIO.setup(16, GPIO.OUT) while True: GPIO.output(16, GPIO.HIGH) GPIO.output(17, GPIO.HIGH) GPIO.output(27, GPIO.HIGH) GPIO.output(22, GPIO.HIGH) time.sleep(2) GPIO.output(17, GPIO.LOW) GPIO.output(27, GPIO.LOW) GPIO.output(22, GPIO.LOW) time.sleep(2) GPIO.cleanup()
I am having some troubles for signalizing of Raspberry Pi digital pins. Let me explain the problem The thing I was trying to do make a single pin constantly open, and ON-OFF other pins Lets say, GPIO.OUT 16 will constantly be open, meanwhile, the PIN 17, 27 and 22 will be open and close in a sequence import time import RPi.GPIO as GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.OUT) GPIO.setup(27, GPIO.OUT) GPIO.setup(22, GPIO.OUT) GPIO.setup(16, GPIO.OUT) GPIO.output(16,...
Solution found via https://pypi.org/project/RPi.GPIO/0.7.1a4/ Change Log :0.7.1a3 Fix PyEval_InitThreads deprecation warning for Python 3.9 (issue 188) Installing latest Version worked: pip3 install RPi.GPIO==0.7.1a4 --- could be closed ---
Solution found via https://pypi.org/project/RPi.GPIO/0.7.1a4/ Change Log :0.7.1a3 Fix PyEval_InitThreads deprecation warning for Python 3.9 (issue 188) Installing latest Version worked: pip3 install RPi.GPIO==0.7.1a4
Compilation Fails with Python 3.9
Callback Function - Strange Behaviour
Ben thanks, that all right!
Ben thanks, that all right, but for new relises ArchlinuxArm-arch64 I made one thing before your installation tips: export CFLAGS="-fcommon" reason here: https://gcc.gnu.org/gcc-10/porting_to.html and then: sudo apt install mercurial $ pip3 install --upgrade hg+http://hg.code.sf.net/p/raspberry-gpio-python/code#egg=RPi.GPIO