twlawrenceko
Posts: 61
Joined: Sat Aug 23, 2014 10:24 am
Contact: Yahoo Messenger

No module named spidev?!

Wed Jul 15, 2015 7:20 am

I bought the ic chip mcp3008 for ADC, analog to digital. Using on my sharp ir sensor. But when i was running the code. It showed "Import Error: "No module named spidev" Here is the photo for my troubleshooting, plz help me!
Thanks for any help.
mcp3008.jpg
mcp3008.jpg (58.53 KiB) Viewed 8856 times
Last edited by twlawrenceko on Thu Jul 16, 2015 3:38 am, edited 1 time in total.
twlawrenceko

User avatar
joan
Posts: 14257
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: No module named spidev?!

Wed Jul 15, 2015 7:58 am

At the top right there is a search box. Enter spidev and press return.

User avatar
B.Goode
Posts: 8504
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: No module named spidev?!

Wed Jul 15, 2015 7:59 am

That error message seems to be telling you that it is not possible to import the spidev python module.

Have you installed that module?

Originally this reply replicated the one from @joan, so the duplicate content has been removed.

twlawrenceko
Posts: 61
Joined: Sat Aug 23, 2014 10:24 am
Contact: Yahoo Messenger

Re: No module named spidev?!

Thu Jul 16, 2015 3:45 am

joan wrote:At the top right there is a search box. Enter spidev and press return.
I don't see any search box on my desktop, my raspbian is the latest version.
raspberry_desktop.jpg
raspberry_desktop.jpg (61.4 KiB) Viewed 8856 times
twlawrenceko

User avatar
sommersoft
Posts: 35
Joined: Sat Jul 11, 2015 1:43 pm
Location: Delaware, US

Re: No module named spidev?!

Thu Jul 16, 2015 4:23 am

Search.jpg
Search.jpg (32.46 KiB) Viewed 8826 times
"We mock what we don't understand." - Dr. Trowbridge

twlawrenceko
Posts: 61
Joined: Sat Aug 23, 2014 10:24 am
Contact: Yahoo Messenger

Re: No module named spidev?!

Thu Jul 16, 2015 4:43 am

sommersoft wrote:
Search.jpg
Sorry, what is this for?
I searched for spidev but there's nothing to do.. Did my network got something wrong?
twlawrenceko

User avatar
sommersoft
Posts: 35
Joined: Sat Jul 11, 2015 1:43 pm
Location: Delaware, US

Re: No module named spidev?!

Thu Jul 16, 2015 4:50 am

That was the "search in the top right" that joan was talking about. But maybe this will be easier...

search.php?keywords=spidev

https://www.google.com/?gws_rd=ssl#q=sp ... errypi.org

https://www.google.com/?gws_rd=ssl#q=no ... med+spidev
"We mock what we don't understand." - Dr. Trowbridge

twlawrenceko
Posts: 61
Joined: Sat Aug 23, 2014 10:24 am
Contact: Yahoo Messenger

Re: No module named spidev?!

Thu Jul 16, 2015 9:41 am

No more solutions?
I searched plenty of spidev, but I tried most of them. But nothing works good on me..
twlawrenceko

User avatar
joan
Posts: 14257
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: No module named spidev?!

Thu Jul 16, 2015 9:54 am

twlawrenceko wrote:No more solutions?
I searched plenty of spidev, but I tried most of them. But nothing works good on me..
I can't see the point of offering a solution if you have already tried all possible solutions.

twlawrenceko
Posts: 61
Joined: Sat Aug 23, 2014 10:24 am
Contact: Yahoo Messenger

Re: No module named spidev?!

Thu Jul 16, 2015 10:03 am

joan wrote:
twlawrenceko wrote:No more solutions?
I searched plenty of spidev, but I tried most of them. But nothing works good on me..
I can't see the point of offering a solution if you have already tried all possible solutions.
I can still try it again, any ideas?
twlawrenceko

User avatar
DougieLawson
Posts: 36104
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: No module named spidev?!

Thu Jul 16, 2015 12:14 pm

twlawrenceko wrote:
sommersoft wrote:
Search.jpg
Sorry, what is this for?
I searched for spidev but there's nothing to do.. Did my network got something wrong?
Mr Sommersoft is using a different skin for the forum, Scroll to the top of the page. Up on the top line, just right of "New Posts" there's a box marked "Search" with a little "magnifying glass" icon
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
DougieLawson
Posts: 36104
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: No module named spidev?!

Thu Jul 16, 2015 3:03 pm

supra wrote: Are you using python3.
If yes. Then type sudo python3 <filename>
How will that help? The problem is that the spidev module isn't installed for python3.

The pi user is connected to the spi group so doesn't need sudo to read/write that interface.

sudo pip-3.2 install spidev
may fix the problem.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

twlawrenceko
Posts: 61
Joined: Sat Aug 23, 2014 10:24 am
Contact: Yahoo Messenger

Re: No module named spidev?!

Mon Jul 20, 2015 5:57 am

DougieLawson wrote:
supra wrote: Are you using python3.
If yes. Then type sudo python3 <filename>
How will that help? The problem is that the spidev module isn't installed for python3.

The pi user is connected to the spi group so doesn't need sudo to read/write that interface.

sudo pip-3.2 install spidev
may fix the problem.
It doesn't work. It said command not found
twlawrenceko

User avatar
joan
Posts: 14257
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: No module named spidev?!

Mon Jul 20, 2015 6:22 am

pigpio does not use the spidev module. It talks directly to the SPI hardware.

User avatar
DougieLawson
Posts: 36104
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: No module named spidev?!

Mon Jul 20, 2015 8:29 am

sudo apt-get install python3-pip
sudo pip-3.2 install spidev
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

twlawrenceko
Posts: 61
Joined: Sat Aug 23, 2014 10:24 am
Contact: Yahoo Messenger

Re: No module named spidev?!

Wed Jul 22, 2015 3:31 am

DougieLawson wrote:sudo apt-get install python3-pip
sudo pip-3.2 install spidev
Although this doesn't work for me, but thanks for any help.

Code: Select all

sudo apt-get install python-dev python-pip

Code: Select all

sudo pip install spidev
I did success, but where's the difference?

http://www.linuxuser.co.uk/news/10-rasp ... des-part-1
twlawrenceko

User avatar
DougieLawson
Posts: 36104
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: No module named spidev?!

Wed Jul 22, 2015 8:27 am

Python2 vs Python3
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

alexey_laa
Posts: 2
Joined: Tue Jan 13, 2015 6:17 pm
Location: Kyiv, Ukraine
Contact: Website

Re: No module named spidev?!

Thu Jul 30, 2015 7:06 pm

Hello.

I experienced the same problem, but with other module. I installed that module on my Raspberry Pi using PIP. Then tried to use it in IDLE3 shell. I didn't found a way to get my module working and got an error "No module named [...]". But then I found that "import [...]" works normally in IDLE (not IDLE3) shell.

As I understand, there are two versions of Python installed on Raspberry Pi. And PIP tool (and my module, accordingly) was installed for the first version only.

Return to “Troubleshooting”