Toly
Toly

Reputation: 3169

No module named tweepy ERROR

I had to reinstall my Python environment to my new laptop with Win 10 (from Win 7). Installation went OK. No errors (just some warnings). Then I tried to run my old program starting with:

import tweepy
from tweepy import OAuthHandler

I got the following error:

ImportError                               Traceback (most recent call last)
<ipython-input-1-52abae0c6e08> in <module>()
----> 1 import tweepy
      2 from tweepy import OAuthHandler

ImportError: No module named tweepy

The strangest thing is that I installed tweepy with no errors using pip install tweepy from C:\Python27\Scripts

I did it even twice and received the message Requirement already satisfied

Please, help

EDIT: I tried pip freeze and I can see tweepy 3.5.0 there However I can not see tweepy anywhere on my drive and especially in Python27 and Python27/Scripts folders

Upvotes: 0

Views: 3071

Answers (2)

Diego Marino
Diego Marino

Reputation: 79

Install it from within Anaconda using

!pip install tweepy

Upvotes: 1

Toly
Toly

Reputation: 3169

It seems the error was caused by 2 factors:

  1. The order of installation of Python 2.7 and Anaconda may have created the error since "pip" is present in both. This could have been a problem

  2. I installed an older version of Anaconda (used with Win 7). It did not create a directory anaconda2 ! When I installed a new version for Win 10 (64 bit) it, in fact, created a directory Anaconda2. No python installation was required since Anaconda did it on its own. Then I used pip install to install tweepy and it worked in my old code

Upvotes: 0

Related Questions