[Solved] Cannot install rpi.gpio

Hi,

I am running the latest stable release of OSMC (4.14.26-2-osmc) on my Raspberry Pi 2 Model B. I need to install the rpi.gpio python package. First I tried sudo apt-get install python-rpi.gpio, but it failed as such package could not be found. Then I installed pip and attempted sudo pip install rpi.gpio - this time it fails with a different error:

osmc@osmc:~$ sudo pip install rpi.gpio
    Collecting rpi.gpio
      Using cached RPi.GPIO-0.6.3.tar.gz
        Complete output from command python setup.py egg_info:
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
        ImportError: No module named setuptools
        
        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ODmsBQ/rpi.gpio/

In fact, after reading this forum and installing the following extra things, I still get the same error as above when I attempt sudo pip install rpi.gpio.

sudo apt-get install python-dev
sudo apt-get install gcc
sudo apt-get install build-essential
export ARCH=arm
sudo export ARCH=arm
export CROSS_COMPILE=/usr/bin/
sudo export CROSS_COMPILE=/usr/bin/

I would truly appreciate if someone could please help! Thanks!

Update: Alright, so I figured I was missing a python module called setuptools, so I installed it just now by sudo apt-get install python-setuptools. Right after I run sudo pip install rpi.gpio - here is the output. Is it ok that it threw those errors related to bdist_wheel?

osmc@osmc:~$ sudo pip install rpi.gpio
Collecting rpi.gpio
  Using cached RPi.GPIO-0.6.3.tar.gz
Building wheels for collected packages: rpi.gpio
  Running setup.py bdist_wheel for rpi.gpio ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-76PclQ/rpi.gpio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmppmQWoHpip-wheel- --python-tag cp27:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help
  
  error: invalid command 'bdist_wheel'
  
  ----------------------------------------
  Failed building wheel for rpi.gpio
  Running setup.py clean for rpi.gpio
Failed to build rpi.gpio
Installing collected packages: rpi.gpio
  Running setup.py install for rpi.gpio ... done
Successfully installed rpi.gpio-0.6.3

pip install wheel may solve it
Otherwise this may be better served elsewhere unfortunately

Thanks! sudo pip install wheel worked great! I now have a working rpi.gpio python module.