5

I am trying to get my Raspberry Pi's GPIO pins working, and I am following Tutorial: How to use your Raspberry Pi like an Arduino.

( I'm working through SSH running Raspbian.) I have successfully installed distribute.

When trying to install PIP, I get the error shown below.

How can I fix it?

    pi@DuckPi ~ $ sudo curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 85929  100 85929    0     0  89250      0 --:--:-- --:--:-- --:--:--  103k
    Downloading/unpacking pip
      Running setup.py egg_info for package pip

        warning: no files found matching '*.html' under directory 'docs'
        warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
        no previously-included directories found matching 'docs/_build/_sources'
    Installing collected packages: pip
      Running setup.py install for pip
        error: could not create '/usr/local/lib/python2.7/dist-packages/pip': Permission denied
        Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/pip/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-6djiJW-record/install-record.txt:
        running install

    running build

    running build_py

    running install_lib

    creating /usr/local/lib/python2.7/dist-packages/pip

    error: could not create '/usr/local/lib/python2.7/dist-packages/pip': Permission denied

    ----------------------------------------
    Command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/pip/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-6djiJW-record/install-record.txt failed with error code 1
    Storing complete log in /home/pi/.pip/pip.log
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ChrisPDuckling
  • 73
  • 1
  • 1
  • 5

4 Answers4

6

It's because curl was sudoed instead of python. You must do:

$ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | sudo python

Or if you prefer, download the file and then run it:

$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ sudo python get-pip.py
Hugo Lopes Tavares
  • 28,528
  • 5
  • 47
  • 45
2

I followed the same tutorial but instead of installing pip I just used:

sudo apt-get install rpi.gpio

The rest of the tutorial worked fine with a bit of searching around for some extra info. My whole experience of simple GPIO introduction the subject of my blog post Using Raspberry GPIO Interface which I hope helps too.

Nishant
  • 54,584
  • 13
  • 112
  • 127
WorkingMatt
  • 639
  • 8
  • 24
2

Nowadays the Debian packages are named:

python-rpi.gpio - Python GPIO module for Raspberry Pi
python3-rpi.gpio - Python 3 GPIO module for Raspberry Pi
pors
  • 3,856
  • 36
  • 33
0

You can also make use of the wiringPi library. It's very easy to use.

Here are the links:

For C: https://github.com/WiringPi/WiringPi

For Python: https://github.com/Gadgetoid/WiringPi2-Python

I hope it helps.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
dhruvvyas90
  • 1,135
  • 1
  • 15
  • 31