1

This is the second time today this has happened..

I tried to import requests earlier and I got an Import Error: no module named requests

Same thing for serial

I googled the crap out of this and nothing I've found works. Any ideas as to what's going on? I'm trying to use pyserial to take input from an arduino

dsolimano
  • 8,870
  • 3
  • 48
  • 63
Daniel Sussman
  • 257
  • 3
  • 11

2 Answers2

1
pip install requests
pip install pyserial

should do it (unless you don't have pip installed)

Loïc Faure-Lacroix
  • 13,220
  • 6
  • 67
  • 99
sb9
  • 1,082
  • 7
  • 18
  • You could add `easy_install` too – Loïc Faure-Lacroix Mar 10 '14 at 09:11
  • I always get a message from the terminal saying both are already installed, but running anything that has import requests or import serial brings up the ImportError – Daniel Sussman Mar 10 '14 at 09:12
  • Uninstall both, reinstall them and check for installation errors. Which python version on which platform? – sb9 Mar 10 '14 at 09:16
  • OK, so I tried uninstalling. I reinstalled Python (with the 2.7.6 Mac OS X 64-bit/32-bit x86-64/i386 Installer) on my Mac running OS X 10.9.2.. I installed ActiveTcl, and the next thing to do is install pip. So I download pip-1.5.4.tar.gz, unzip and run python get-pip.py to find: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'get-pip.py': [Errno 2] No such file or directory – Daniel Sussman Mar 10 '14 at 09:29
  • [Installing pip on Mac OS X](http://stackoverflow.com/questions/17271319/installing-pip-on-mac-os-x) – Fookatchu Mar 10 '14 at 09:41
  • THanks - it was the sudo that did it. THanks for all your help everyone, uninstalling and reinstalling seemed to do the trick – Daniel Sussman Mar 10 '14 at 09:52
0

are you looking for urllib.requests? if you are using python 2.7 when you ask for requests you import urllib and you don't actually use request, but its methods are available to the urllib handle, so for instance:

urllib.urlopen("http://google.com")

will work in python 2.7.x, where

urllib.request.urlopen("http://google.com")

will work in python3.x.x

kinghenry14
  • 1,187
  • 1
  • 11
  • 34