bear / python-twitter

A Python wrapper around the Twitter API.
Apache License 2.0
3.41k stars 955 forks source link

ModuleNotFoundError: No module named 'twitter' #653

Closed orjanj closed 4 years ago

orjanj commented 4 years ago

After following the installation, I integrated the test code to check the connection to Twitter. It seems like there's a issue with python3 running python-twitter, since I get the correct response when running python2.

# python3 Twitter.py
Traceback (most recent call last):
  File "Twitter.py", line 2, in <module>
    import twitter
ModuleNotFoundError: No module named 'twitter'

# python2 Twitter.py
{"created_at": "Sun Jan 30 hh:mm:ss +0000 2020", "default_profile": true, "default_profile_image": true, "friends_count": n, "id": 1234567890123456789, "id_str": "1234567890123456789", "name": "accname", "profile_background_color": "FFFFFF", "profile_image_url": "http://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png", "profile_image_url_https": "https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png", "profile_link_color": "000000", "profile_sidebar_border_color": "C0DEED", "profile_sidebar_fill_color": "DDEEF6", "profile_text_color": "333333", "profile_use_background_image": true, "screen_name": "screenname"}

Have tried to uninstall earlier versions of twitter and python-twitter, reinstalled it and everything, does not seems like it's working.

Python-versions:

# python2 --version && python3 --version && pip --version
Python 2.7.17
Python 3.6.9
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

Any idea of what the issue might be?

stephanebruckert commented 4 years ago

Try pip3 install python-twitter

orjanj commented 4 years ago

Try pip3 install python-twitter

Thanks @stephanebruckert, that worked of course. Had forgotten to run it in pip3. Also, I missed the package python3-pip, so by installing it that solved the case.