hankso / gpio4

Improved gpio module based on Sysfs and gpio3, drop-in replacement of RPi.GPIO
MIT License
8 stars 5 forks source link

No module named 'gpio4.GPIO' #3

Open nox0x1 opened 3 years ago

nox0x1 commented 3 years ago

Installed gpio4 using "python3 -m pip install gpio4" on OpenWrt. While importing- gpio4.GPIO as GPIO, the following error occurs:

Traceback (most recent call last):
  File "/usr/pycode/lcd.py", line 38, in <module>
    import gpio4.GPIO as GPIO
ModuleNotFoundError: No module named 'gpio4.GPIO'
i0466lt commented 2 years ago

Same here on ASUS Tinkerboard. Any solution?

RobertAByrnes commented 1 year ago

Same here on Banana Pi M64

evandene commented 1 year ago

Same here on the Banana Pi M2 Zero Armbian 22.11.0-trunk Bullseye

Installation: pi@clearview:~$ sudo pip install gpio4 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple/ Requirement already satisfied: gpio4 in /usr/local/lib/python3.9/dist-packages (0.1.4) WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Running a python script: pi@clearview:~$ sudo python3 motion_on_off2a.py Traceback (most recent call last): File "/home/pi/motion_on_off2a.py", line 2, in import gpio4.GPIO as GPIO ModuleNotFoundError: No module named 'gpio4.GPIO'

evandene commented 1 year ago

After a fresh Armbian 22.11.0-trunk Bullseye installation and: sudo python3 pip install gpio4, the installation is completed.

Question: Where can I find the BCM pin numbers from the BPI M2 Zero? I was trying the pin numbers according the BCM column from the BPI M2 Zero wiki website but that was resulting in errors. See below

pi@clearview:~$ sudo python3 motion_on_off2a.py Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/gpio4/init.py", line 393, in _get_pin_num p = self._mode[pin] KeyError: 2

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pi/motion_on_off2a.py", line 30, in GPIO.setup([2, 67], GPIO.IN) File "/usr/local/lib/python3.9/dist-packages/gpio4/init.py", line 424, in setup pins = [self._get_pin_num(p) for p in self._listify(pin)] File "/usr/local/lib/python3.9/dist-packages/gpio4/init.py", line 424, in pins = [self._get_pin_num(p) for p in self._listify(pin)] File "/usr/local/lib/python3.9/dist-packages/gpio4/init.py", line 395, in get_pin_num raise KeyError(('Invalid pin({}) or unsupported mode!\n' KeyError: 'Invalid pin(2) or unsupported mode!\nReset mode and check pin num.'