0
votes

from wordcloud import WordCloud

While importing WordCloud I get below issue.Can you help with this?

RuntimeWarning: The _imaging extension was built for another version of Pillow or PIL: Core version: 5.1.0 Pillow version: 4.2.1 "The _imaging extension was built for Python with UCS2 support; "


ImportError Traceback (most recent call last) in () ----> 1 from wordcloud import WordCloud

:\Users\jhaas\Anaconda2\lib\site-packages\wordcloud__init__.py in () ----> 1 from .wordcloud import (WordCloud, STOPWORDS, random_color_func, 2 get_single_color_func) 3 from .color_from_image import ImageColorGenerator 4 5 all = ['WordCloud', 'STOPWORDS', 'random_color_func',

C:\Users\jhaas\Anaconda2\lib\site-packages\wordcloud\wordcloud.py in () 17 from operator import itemgetter 18 ---> 19 from PIL import Image 20 from PIL import ImageColor 21 from PIL import ImageDraw

C:\Users\jhaas\Anaconda2\lib\site-packages\PIL\Image.py in () 65 "Pillow version: %s" % 66 (getattr(core, 'PILLOW_VERSION', None), ---> 67 PILLOW_VERSION)) 68 69 except ImportError as v:

ImportError: The _imaging extension was built for another version of Pillow or PIL: Core version: 5.1.0 Pillow version: 4.2.1

1

1 Answers

0
votes

This is a Pillow problem, rather than a WordCloud problem. As it says, your Pillow installation has somehow become part 4.2.1, part 5.1.0. The simplest solution would be to reinstall Pillow.