Reputation: 414
I'm running a code project I've downloaded from Github that uses the TwitterAPI.
I've followed the instructions in the README to install it with
pip TwitterAPI
but when I run the python script I'm getting an error that I can't seem to trouble shoot. Apologies... I'm a bit of a Python newb but it looks like requests is installed...
$ python main.py
Traceback (most recent call last):
File "main.py", line 1, in <module>
from TwitterAPI import TwitterAPI
File "/usr/local/lib/python2.7/dist-packages/TwitterAPI/TwitterAPI.py", line 9, in <module>
from requests.exceptions import ConnectionError, ReadTimeout, SSLError
ImportError: cannot import name ReadTimeout
It looks like there's two locations for python libs /usr/local/lib/
and /usr/lib/
. I've syslinked the requests lib folder from /usr/lib/
into /usr/local/lib/
but this doesn't appear to have fixed the error.
$ ll /usr/local/lib/python2.7/dist-packages/
total 584K
drwxr-sr-x 4 root staff 4.0K Jan 5 2015 cffi-0.8.6-py2.7-linux-armv7l.egg
drwxr-sr-x 4 root staff 4.0K Jan 5 2015 cryptography-0.7.1-py2.7-linux-armv7l.egg
-rw-r--r-- 1 root staff 402 Jan 5 2015 easy-install.pth
-rw-r--r-- 1 root root 77K Jan 5 2015 enum34-1.0.4-py2.7.egg
drwxr-sr-x 4 root staff 4.0K Dec 22 23:11 oauthlib
drwxr-sr-x 2 root staff 4.0K Dec 22 23:11 oauthlib-1.0.3.egg-info
-rw-r--r-- 1 root root 78K Jan 5 2015 pyasn1-0.1.7-py2.7.egg
-rw-r--r-- 1 root root 194K Jan 5 2015 pycparser-2.10-py2.7.egg
-rw-r--r-- 1 root staff 185K Jan 5 2015 pyOpenSSL-0.14-py2.7.egg
lrwxrwxrwx 1 root staff 41 Dec 23 00:14 requests -> /usr/lib/python2.7/dist-packages/requests
lrwxrwxrwx 1 root staff 56 Dec 23 00:14 requests-2.2.1.egg-info -> /usr/lib/python2.7/dist-packages/requests-2.2.1.egg-info
drwxr-sr-x 3 root staff 4.0K Dec 22 23:52 requests_oauthlib
drwxr-sr-x 2 root staff 4.0K Dec 22 23:52 requests_oauthlib-0.6.0.dist-info
-rw-r--r-- 1 root staff 33 Jan 5 2015 setuptools.pth
drwxr-sr-x 2 root staff 4.0K Dec 22 23:52 TwitterAPI
drwxr-sr-x 2 root staff 4.0K Dec 22 23:52 TwitterAPI-2.3.6.egg-info
Upvotes: 3
Views: 1762
Reputation: 1898
Because you have so many versions of python and requests installed, you should be using virtualenv to create a python environment that exactly matches the complier version and packages you need
Upvotes: 1
Reputation: 59671
It appears you have multiple versions of the requests library installed, and one is a very old version:
See solution here: https://github.com/geduldig/TwitterAPI/issues/46
Take a look into both
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
and delete the requests folder that doesn't end in 2.9.1.
Alternatively you can just delete all requests*
folders in both locations, and reinstall requests again afterwards.
Upvotes: 4