4

I don't know what I'm doing wrong here:

Sun Oct 14$ pip install python-twitter
Requirement already satisfied (use --upgrade to upgrade): python-twitter in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from python-twitter)
Requirement already satisfied (use --upgrade to upgrade): simplejson in /Library/Python/2.7/site-packages (from python-twitter)
Requirement already satisfied (use --upgrade to upgrade): oauth2 in /Library/Python/2.7/site-packages (from python-twitter)
Requirement already satisfied (use --upgrade to upgrade): httplib2 in /Library/Python/2.7/site-packages (from oauth2->python-twitter)
Cleaning up...
Sun Oct 14$ python
Python 2.7.2 (default, Nov 17 2011, 13:22:48) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import twitter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named twitter
>>> 

Do I need to do a virtualenv? What else could be going on? Sorry for my lack of understanding but any help is appreciated.

edit #1 trying to get tweepy working but.... possibly might have two versions of Python 2.7 here

Sun Oct 14$ pip install --upgrade tweepy
Requirement already up-to-date: tweepy in ./tweepy-1.11-py2.7.egg
Cleaning up...
Sun Oct 14$ python
Python 2.7.2 (default, Nov 17 2011, 13:22:48) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tweepy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named tweepy
>>> 

I think I might have two versions of Python 2.7 installed; one via homebrew and the Apple default. Is it possible that the homebrew install would put packages in /Library/Python/2.7/site-packages?

again, thx in advance

timpone
  • 19,235
  • 36
  • 121
  • 211

1 Answers1

1

From what I've read, python-twitter:

Relies on Basic-Auth which Twitter switched off sometime between August and September (2010). Only OAuth is supported by the API, and python-twitter doesn't support this.

UPDATE: I just tried installing python-twitter using the exact same method you used and I am unable to import it as well. After doing some research I came across Python Twitter Tools, which I believe is python-twitter's replacement.

Installing twitter requires setuptools. It's just easy_install twitter to install it from the web.

Scott Bartell
  • 2,801
  • 3
  • 24
  • 36
  • thx, trying to get tweepy working but still getting a similar error. hmm.... any ideas on resolution? Python is definitely not my strong suit – timpone Oct 15 '12 at 04:39
  • Actually instead of pip, try `sudo esay_install twitter` which requires setuptools. http://mike.verdone.ca/twitter/#install This seems to be working for me. – Scott Bartell Oct 15 '12 at 04:41
  • I've tried this before but no dice, get the `ImportError: No module named twitter`, let me see in a virtualenv, – timpone Oct 15 '12 at 04:49
  • I guess it might be installing the module in your other install of Python, which is why the import would be failing. – Scott Bartell Oct 15 '12 at 04:53
  • yeah, I think I have two system versions of python2.7 and the site-packages MIGHT be going at wrong places. creating a virtualenv at least made the site-packages more explicit (as you say in previous comment). thx Scott – timpone Oct 15 '12 at 04:55