Using GPIO pins from Python

This forum is for topics dealing with problems with software specifically in the ARMv7h repo.

Re: Using GPIO pins from Python

Postby unformatted » Fri Aug 20, 2021 1:19 pm

@robg: thanks for investigating but meanwhile I also was able to pip install gpiozero. The problem however is trying to pip install rpi.gpio. Try that and see for yourself!
unformatted
 
Posts: 121
Joined: Tue Mar 09, 2021 5:23 pm

Re: Using GPIO pins from Python

Postby robg » Fri Aug 20, 2021 3:18 pm

This should do:
$this->bbcode_second_pass_code('', '[root@alarm alarm]# CFLAGS=-fcommon pip3 install RPi.GPIO
WARNING: The directory '/home/alarm/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting RPi.GPIO
Downloading RPi.GPIO-0.7.0.tar.gz (30 kB)
Using legacy 'setup.py install' for RPi.GPIO, since package 'wheel' is not installed.
Installing collected packages: RPi.GPIO
Running setup.py install for RPi.GPIO ... done
Successfully installed RPi.GPIO-0.7.0')

See "-fno-common" in https://man7.org/linux/man-pages/man1/gcc.1.html and compare with the errors you observed.
robg
 
Posts: 194
Joined: Tue Jan 05, 2021 8:22 am

Re: Using GPIO pins from Python

Postby unformatted » Fri Aug 20, 2021 4:01 pm

Meanwhile I found an older thread mentioning a change in gcc 10 also suggesting using CFLAGS="-fcommon" pip install rpi.gpio like you said (viewtopic.php?t=14731). Also more recently another solution suggesting installing a pre-release of rpi.gpio (viewtopic.php?f=57&t=15418) which already has the gcc change implemented.

So I installed rpi.gpio using the CFLAG="-fcommon" prefix and that leaves me with the latest stable version and everything works fine. Same version 0.7.0 as with the AUR package so no suprises on my old Pi projects which all use rpi.gpio.

Thanks a lot you guys for helping me out.
unformatted
 
Posts: 121
Joined: Tue Mar 09, 2021 5:23 pm

Re: Using GPIO pins from Python

Postby unformatted » Fri Aug 20, 2021 4:18 pm

@robg: one more thing I almost forgot, you suggested to me contributing this to the wiki (using pip instead of the AUR package) but to be honest I never used git before. I've read your link but I'm afraid that's a little above my knowledge.
unformatted
 
Posts: 121
Joined: Tue Mar 09, 2021 5:23 pm

Re: Using GPIO pins from Python

Postby robg » Fri Aug 20, 2021 10:27 pm

Alas, again we see that searching helps. Which in turn highlights the importance of an up-to-date wiki to prevent such situations.
How about - of course, only if you wish to contribute - you open a new thread (in, say, "Community Guides") and write a proposal for an up-to-date version of the GPIO section? Once everyone is happy with the contents, it can be contributed via GitHub. Also, kindly prepend [SOLVED] to the title of this thread, so the answer is easy to spot for other people facing this problem.
robg
 
Posts: 194
Joined: Tue Jan 05, 2021 8:22 am

Re: Using GPIO pins from Python

Postby bulletmark » Sat Aug 21, 2021 12:23 am

@robg, you are not installing from source like he is. See my post above. You have python-wheel installed so are getting the wheel install.

PS: posted this before I saw there was a second page here. This was just a comment to robg on 1st page why he could install rpi.gpio fine.
bulletmark
 
Posts: 102
Joined: Tue Oct 13, 2015 10:17 pm

Re: Using GPIO pins from Python

Postby robg » Sat Aug 21, 2021 12:53 am

Hmm, interesting. I don't use Python much and only know that "wheels" are - roughly speaking - Python's version of binary packages. I certainly don't have the "python-wheel" package installed:
$this->bbcode_second_pass_code('', '[alarm@alarm ~]$ pacman -Ss python-wheel
community/python-wheel 0.37.0-1
A built-package format for Python
[alarm@alarm ~]$ pacman -Qs python-wheel
[alarm@alarm ~]$')
Could it be that "python-wheel" is only used for building "wheels", not for running them?
robg
 
Posts: 194
Joined: Tue Jan 05, 2021 8:22 am

Re: Using GPIO pins from Python

Postby bulletmark » Sat Aug 21, 2021 1:03 am

OK, obviously I don't understand this either! You can see from your log that you installed the wheel binary but his log says:

$this->bbcode_second_pass_code('', '
Using legacy 'setup.py install' for RPi.GPIO, since package 'wheel' is not installed.
')
So that is the reason for the difference and seems to clearly say it is because the wheel package is not installed(?!)
bulletmark
 
Posts: 102
Joined: Tue Oct 13, 2015 10:17 pm

Re: Using GPIO pins from Python

Postby robg » Sat Aug 21, 2021 1:49 am

I may look into this in more detail later, but for now my guess (based on the log) is that the author-defined install routine in setup.py pulls the wheel files (assuming they can be run, which would agree with my previous assumption on the "python-wheel" package being required for building only.)
robg
 
Posts: 194
Joined: Tue Jan 05, 2021 8:22 am

[SOLVED] Re: Using GPIO pins from Python

Postby unformatted » Sat Aug 21, 2021 8:01 am

I will make a proposal and post a link here once done. But first I'm updating my own wiki and then apply all this to all my Pi's still using the AUR packages. Those involve Pi zero, 3 and 4. Should work but seeing is believing.
unformatted
 
Posts: 121
Joined: Tue Mar 09, 2021 5:23 pm

PreviousNext

Return to ARMv7h

Who is online

Users browsing this forum: No registered users and 9 guests