samuelklit
Posts: 13
Joined: Thu Jul 24, 2014 7:09 pm

RPI.GPIO import error

Thu Jul 24, 2014 7:17 pm

Hi,

I have just got a raspberry pi 4 days ago. There have been lot’s of erorrs with it but now I fixed all….. ALMOST,

There is one problem and I can’t figure it out!

The problem is that I can’t use the GPIO pins, Then I try to run my script it says that it can't find a module named RPI.GPIO
By the way it's a B+

I have tried everything possibly available on the internet, None of it worked

I really hope that you can help(Please in depth details)


Thank

DirkS
Posts: 10371
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: RPI.GPIO import error

Thu Jul 24, 2014 9:44 pm

The name of the module is case sensitive: RPi.GPIO (first 'i' is lowercase)

Gr.
Dirk.

samuelklit
Posts: 13
Joined: Thu Jul 24, 2014 7:09 pm

Re: RPI.GPIO import error

Fri Jul 25, 2014 7:23 am

Yeah i know but still dont Work

User avatar
DougieLawson
Posts: 39301
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RPI.GPIO import error

Fri Jul 25, 2014 8:10 am

Are you using python2 or python3?

sudo apt-get install python3-pip
sudo pip3 install RPi.GPIO
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
PeterO
Posts: 5951
Joined: Sun Jul 22, 2012 4:14 pm

Re: RPI.GPIO import error

Fri Jul 25, 2014 8:18 am

Please post a short example of your code that shows the problem.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

samuelklit
Posts: 13
Joined: Thu Jul 24, 2014 7:09 pm

Re: RPI.GPIO import error

Fri Jul 25, 2014 9:36 am

DougieLawson i use python3.
The first line of code worked "sudo apt-get install python3-pip". :)
But when i was trying the secund line it sayed "pip3: command not found" :(

User avatar
DougieLawson
Posts: 39301
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RPI.GPIO import error

Fri Jul 25, 2014 9:42 am

Try sudo /usr/bin/pip3 install RPi.GPIO
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

samuelklit
Posts: 13
Joined: Thu Jul 24, 2014 7:09 pm

Re: RPI.GPIO import error

Fri Jul 25, 2014 9:44 am

Same error :(
But thanks for fast answer :D

User avatar
DougieLawson
Posts: 39301
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RPI.GPIO import error

Fri Jul 25, 2014 9:57 am

samuelklit wrote:Same error :(
But thanks for fast answer :D
Odd, very odd.

What does
sudo dpkg-query -L python3-pip
show?
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

samuelklit
Posts: 13
Joined: Thu Jul 24, 2014 7:09 pm

Re: RPI.GPIO import error

Fri Jul 25, 2014 10:01 am

It says:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii python3-pip 1.1-3 all alternative Python package instal

User avatar
DougieLawson
Posts: 39301
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RPI.GPIO import error

Fri Jul 25, 2014 10:02 am

sudo apt-get purge python3-pip
sudo apt-get install python3-pip
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

samuelklit
Posts: 13
Joined: Thu Jul 24, 2014 7:09 pm

Re: RPI.GPIO import error

Fri Jul 25, 2014 10:07 am

It doesnt work:(
Do i need to restart maybe?

User avatar
DougieLawson
Posts: 39301
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RPI.GPIO import error

Fri Jul 25, 2014 10:15 am

samuelklit wrote:It doesnt work:(
Do i need to restart maybe?
Shouldn't need to.

Try
sudo -i
apt-get update
apt-get purge python3-pip
apt-get install python3-pip
which pip3
pip3 install RPi.GPIO
exit
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

samuelklit
Posts: 13
Joined: Thu Jul 24, 2014 7:09 pm

Re: RPI.GPIO import error

Fri Jul 25, 2014 10:24 am

Then i tried "pip3 install RPi.GPIO" i sayed:
-bash: pip3: command not found

:(

User avatar
DougieLawson
Posts: 39301
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RPI.GPIO import error

Fri Jul 25, 2014 10:34 am

samuelklit wrote:Then i tried "pip3 install RPi.GPIO" i sayed:
-bash: pip3: command not found

:(
You need to tell me what happens when you try the apt-get install. That's the step that is going wrong.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

samuelklit
Posts: 13
Joined: Thu Jul 24, 2014 7:09 pm

Re: RPI.GPIO import error

Fri Jul 25, 2014 10:41 am

Okay here is what happens when i try "apt-get install python3-pip"

Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Here what happens when i try "apt-get update"

Hit http://raspberrypi.collabora.com wheezy Release.gpg
Hit http://raspberrypi.collabora.com wheezy Release
Hit http://mirrordirector.raspbian.org wheezy Release.gpg
Hit http://archive.raspberrypi.org wheezy Release.gpg
Hit http://repository.wolfram.com stable Release.gpg
Hit http://mirrordirector.raspbian.org wheezy Release
Hit http://archive.raspberrypi.org wheezy Release
Hit http://repository.wolfram.com stable Release
Hit http://raspberrypi.collabora.com wheezy/rpi armhf Packages
Hit http://mirrordirector.raspbian.org wheezy/main armhf Packages
Hit http://mirrordirector.raspbian.org wheezy/contrib armhf Packages
Hit http://mirrordirector.raspbian.org wheezy/non-free armhf Packages
Hit http://mirrordirector.raspbian.org wheezy/rpi armhf Packages
Hit http://archive.raspberrypi.org wheezy/main armhf Packages
Ign http://raspberrypi.collabora.com wheezy/rpi Translation-en_US
Ign http://raspberrypi.collabora.com wheezy/rpi Translation-en
Ign http://archive.raspberrypi.org wheezy/main Translation-en_US
Ign http://archive.raspberrypi.org wheezy/main Translation-en
Hit http://repository.wolfram.com stable/non-free armhf Packages
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en_US
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en_US
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en_US
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en
Ign http://repository.wolfram.com stable/non-free Translation-en_US
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en_US
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en
Ign http://repository.wolfram.com stable/non-free Translation-en
Reading package lists... Done

User avatar
DougieLawson
Posts: 39301
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RPI.GPIO import error

Fri Jul 25, 2014 10:53 am

sudo -i
cd /tmp
wget http://mirrordirector.raspbian.org/raspbian/pool/main/p/python-pip/python3-pip_1.1-3_all.deb
dpkg -i python3-pip_1.1-3_all.deb
pip3 install RPi.GPIO
exit
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

samuelklit
Posts: 13
Joined: Thu Jul 24, 2014 7:09 pm

Re: RPI.GPIO import error

Fri Jul 25, 2014 11:05 am

Same thing again:(

Here's the log:

pi@raspberrypi ~ $ sudo -i
root@raspberrypi:~# cd /tmp
root@raspberrypi:/tmp# wget http://mirrordirector.raspbian.org/rasp ... -3_all.deb
--2014-07-25 11:03:50-- http://mirrordirector.raspbian.org/rasp ... -3_all.deb
Resolving mirrordirector.raspbian.org (mirrordirector.raspbian.org)... 5.153.225.207, 2001:41c9:1:3ce::11
Connecting to mirrordirector.raspbian.org (mirrordirector.raspbian.org)|5.153.225.207|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://mirrors.dotsrc.org/raspbian/rasp ... -3_all.deb [following]
--2014-07-25 11:03:50-- http://mirrors.dotsrc.org/raspbian/rasp ... -3_all.deb
Resolving mirrors.dotsrc.org (mirrors.dotsrc.org)... 130.225.254.116, 2001:878:346::116
Connecting to mirrors.dotsrc.org (mirrors.dotsrc.org)|130.225.254.116|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 79700 (78K) [application/x-debian-package]
Saving to: `python3-pip_1.1-3_all.deb'

100%[======================================>] 79,700 --.-K/s in 0.09s

2014-07-25 11:03:50 (843 KB/s) - `python3-pip_1.1-3_all.deb' saved [79700/79700]

root@raspberrypi:/tmp# dpkg -i python3-pip_1.1-3_all.deb
(Reading database ... 70848 files and directories currently installed.)
Preparing to replace python3-pip 1.1-3 (using python3-pip_1.1-3_all.deb) ...
Unpacking replacement python3-pip ...
Setting up python3-pip (1.1-3) ...
Processing triggers for man-db ...
root@raspberrypi:/tmp# pip3 install RPi.GPIO
-bash: pip3: command not found
root@raspberrypi:/tmp#

User avatar
DougieLawson
Posts: 39301
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RPI.GPIO import error

Fri Jul 25, 2014 11:12 am

Arrrggghhhh!

It doesn't make any sense.

So hit it with sudo shutdown -r now and see if the "Have you switched it off and on?" approach to software troubleshooting has any effect at all. I'm not hopeful, but I'm completely confused.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
croston
Posts: 708
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: RPI.GPIO import error

Fri Jul 25, 2014 11:23 am

You could possibly try:

Code: Select all

pip-3.2 install RPi.GPIO
or:

Code: Select all

pip3.2 install RPi.GPIO

samuelklit
Posts: 13
Joined: Thu Jul 24, 2014 7:09 pm

Re: RPI.GPIO import error

Fri Jul 25, 2014 12:17 pm

Still dont work :|
Iam currently trying to install raspian again

samuelklit
Posts: 13
Joined: Thu Jul 24, 2014 7:09 pm

Re: RPI.GPIO import error

Fri Jul 25, 2014 4:17 pm

Update:

I reinstalled raspian and gues what it WORKS!! :P :D :o

Return to “Troubleshooting”