[Solved]: ModuleNotFoundError: No module named 'wikipedia'


I am trying to import Wikipedia. I have the following code

from nltk.stem.porter import PorterStemmerfrom nltk.corpus import stopwordsfrom nltk.tokenize import RegexpTokenizerfrom gensim import corpora, modelsimport wikipediaimport gensim

I got the following error.

---------------------------------------------------------------------------ModuleNotFoundError                       Traceback (most recent call last) in ()      3 from nltk.tokenize import RegexpTokenizer      4 from gensim import corpora, models----> 5 import wikipedia      6 import gensimModuleNotFoundError: No module named 'wikipedia'

Solution: install Wikipedia using

pip install wikipedia

Note:  If using Python3 be sure to use pip3 instead of pip for installing Wikipedia.