Pip install RPIO, RPi.GPIO ... error

Hello friends sorry for my english. I have RpiZero WH and i build Openwrt 18.06 branch.
Everything works great. But I have a problem installing the RPi.GPIO, RPIO python package.

root@OpenWrt:~# pip install RPIO
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting RPIO
  Downloading https://files.pythonhosted.org/packages/29/05/6884572923c57ff488fdf5c4ab887deb9edb2515afbcb49be087c95ac698/RPIO-0.10.0.tar.gz
Installing collected packages: RPIO
  Running setup.py install for RPIO ... error
ERROR: Command "/usr/bin/python2.7 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ovBE3q/RPIO/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-mA2l8_/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-ovBE3q/RPIO/
root@OpenWrt:~# pip install RPi.GPIO
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting RPi.GPIO
  Downloading https://files.pythonhosted.org/packages/af/2f/407b6e4cc8a0bdf434825a160bba1807991886b63cce16a5f1a6e1f24cdf/RPi.GPIO-0.6.5.tar.gz
Installing collected packages: RPi.GPIO
  Running setup.py install for RPi.GPIO ... error
ERROR: Command "/usr/bin/python2.7 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-lViSTi/RPi.GPIO/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-o6rIT2/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-lViSTi/RPi.GPIO/
root@OpenWrt:~#

Every time I have the same error. Maybe someone would help me with this. I would be very grateful for help.

You "can't" compile or build Python packages (or anything else, for that matter) on your OpenWrt box. If pip needs to build a binary, then it needs to be done on a build host as a package.

I don't see RPIO available as a package. You might want to examine other options for GPIO manipulation.

(Also take note of the Python 2 EOL notice. OpenWrt will be following shortly, with only Python 3 packages accepted.)

1 Like

Yes you can, use pip,

for example try:

pip install requests
pip install configparser
pip install logging

it works.

try:

opkg install python-setuptools
pip install wheel
pip install venv

2 Likes

Unfortunately it does not work ;( wenv could not find...

root@OpenWrt:~# opkg install python-setuptools
Package python-setuptools (39.0.1-2) installed in root is up to date.
root@OpenWrt:~# pip install wheel
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl
Installing collected packages: wheel
Successfully installed wheel-0.33.4
root@OpenWrt:~# pip install venv
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting venv
  ERROR: Could not find a version that satisfies the requirement venv (from versions: none)
ERROR: No matching distribution found for venv
root@OpenWrt:~# pip install RPIO
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting RPIO
  Downloading https://files.pythonhosted.org/packages/29/05/6884572923c57ff488fdf5c4ab887deb9edb2515afbcb49be087c95ac698/RPIO-0.10.0.tar.gz
Building wheels for collected packages: RPIO
  Building wheel for RPIO (setup.py) ... error
  ERROR: Failed building wheel for RPIO
  Running setup.py clean for RPIO
Failed to build RPIO
Installing collected packages: RPIO
  Running setup.py install for RPIO ... error
ERROR: Command "/usr/bin/python2.7 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-gCE_a3/RPIO/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-9YwA3p/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-gCE_a3/RPIO/
root@OpenWrt:~#

Sorry, my mistake, it was:

pip install virtualenv
and
opkg install python-dev

then upgrade pip form 9.0.3 to 19.1.1

pip install --upgrade pip

you should see something like this:

*root@OpenWrt:~# pip install --upgrade pip*
*Collecting pip*
*  Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB)*
*    100% |████████████████████████████████| 1.4MB 96kB/s *
*Installing collected packages: pip*
*  Found existing installation: pip 9.0.3*
*    Uninstalling pip-9.0.3:*
*      Successfully uninstalled pip-9.0.3*
* Successfully installed pip-19.1.1*
1 Like

and finally gcc is needed to compile the two python packages:

opkg install gcc

(it takes a few minutes to install all dependencies)

I've just tested it (in a NOT Raspberry OpenWRT device with just 128 Meg of RAM) and both packages were successfully installed :wink:

*root@OpenWrt:~# pip install rpi.gpio*
*DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.*
*Collecting rpi.gpio*
*  Using cached https://files.pythonhosted.org/packages/af/2f/407b6e4cc8a0bdf434825a160bba1807991886b63cce16a5f1a6e1f24cdf/RPi.GPIO-0.6.5.tar.gz*
*Building wheels for collected packages: rpi.gpio*
*  Building wheel for rpi.gpio (setup.py) ... done*
*  Stored in directory: /tmp/.cache/wheels/6d/fc/be/f0bd634b0033499def11c5c8b63731c3de443eed482dbe4c71*
*Successfully built rpi.gpio*
*Installing collected packages: rpi.gpio*
*Successfully installed rpi.gpio-0.6.5*

*root@OpenWrt:~# pip install gpio*
*DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.*
*Collecting gpio*
*  Downloading https://files.pythonhosted.org/packages/bf/3c/475c228923c465245bf267a6654b82128823b4b3f2f12801e06bfdc201a0/gpio-0.3.0.tar.gz*
*Building wheels for collected packages: gpio*
*  Building wheel for gpio (setup.py) ... done*
*  Stored in directory: /tmp/.cache/wheels/bf/bf/bc/f5b88d5b7217aa7d86443a9fc177c8db5a9fd1f7b2c107bd77*
*Successfully built gpio*
*Installing collected packages: gpio*
*Successfully installed gpio-0.3.0*
1 Like

Python can expand the capabilities of a router with OpenWRT adding many and many new features, just see my How-To's about LCD display and I2C sensors connected to an OpenWRT router :grinning:

2 Likes

Thanks friends for your help rpi.gpio installed perfect.

root@OpenWrt:~# pip install rpi.gpio
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting rpi.gpio
  Downloading https://files.pythonhosted.org/packages/af/2f/407b6e4cc8a0bdf434825a160bba1807991886b63cce16a5f1a6e1f24cdf/RPi.GPIO-0.6.5.tar.gz
Building wheels for collected packages: rpi.gpio
  Building wheel for rpi.gpio (setup.py) ... done
  Stored in directory: /tmp/.cache/wheels/6d/fc/be/f0bd634b0033499def11c5c8b63731c3de443eed482dbe4c71
Successfully built rpi.gpio
Installing collected packages: rpi.gpio
Successfully installed rpi.gpio-0.6.5

But this packet RPIO fail ;(
https://pypi.org/project/RPIO/

root@OpenWrt:~# pip install RPIO
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting RPIO
  Downloading https://files.pythonhosted.org/packages/29/05/6884572923c57ff488fdf5c4ab887deb9edb2515afbcb49be087c95ac698/RPIO-0.10.0.tar.gz
Building wheels for collected packages: RPIO
  Building wheel for RPIO (setup.py) ... error
  ERROR: Failed building wheel for RPIO
  Running setup.py clean for RPIO
Failed to build RPIO
Installing collected packages: RPIO
  Running setup.py install for RPIO ... error
ERROR: Command "/usr/bin/python2.7 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ee918d/RPIO/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-Bx7gJC/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-ee918d/RPIO/

When i try install via easy-install:

root@OpenWrt:~# easy_install -U RPIO
Searching for RPIO
Reading https://pypi.python.org/simple/RPIO/
Download error on https://pypi.python.org/simple/RPIO/: [SSL: CERTIFICATE_VERIFY_FAILED] unknown error (_ssl.c:726) -- Some packages may not be found!
Couldn't find index page for 'RPIO' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] unknown error (_ssl.c:726) -- Some packages may not be found!
No local packages or working download links found for RPIO
error: Could not find suitable distribution for Requirement.parse('RPIO')

Thank you for your help....

OK all work perfect I must install

opkg install luci-ssl-openssl curl ca-bundle

And all work fine :wink:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.