Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing wordcloud using Jupyter Notebook

Tags:

python

import

pip

I need to solve a wordcloud problem for a homework assignment.

Unfortunately, I am having a hard time getting wordcloud installed into my environment.

Here is the code I am running:

import os
import matplotlib.pyplot as plt
from wordcloud import WordCloud

I get the following error:

ImportError: No module named 'wordcloud'

Now, I know I need to use the pip install method in my command prompt to get wordcloud into my environment. Even after doing this (and trying several different destinations, including my home directory and the Anaconda3 environment), I continue to get the same error.

What am I doing wrong?

like image 674
Andrew Smith Avatar asked Jan 22 '17 15:01

Andrew Smith


3 Answers

Try

python -m pip install wordcloud

You probably need numpy and pillow as well.

like image 187
Harald Nordgren Avatar answered Oct 13 '22 09:10

Harald Nordgren


Try this on Jupyter cell:

!pip install wordcloud
like image 10
Thiru Balaji G Avatar answered Oct 13 '22 11:10

Thiru Balaji G


this solution solved my problem which was because of different pythons on my system.

in Jupyter, run:

import sys
print(sys.executable)

to see which python you are using. copy the pass and install the wordcloud with this command from your Jupiter terminal:

path/to/python -m pip install some_package

Which in my case is:

/anaconda3/bin/python -m pip install wordcloud

and import in your code:

from wordcloud import WordCloud

The source i used: can't import

like image 6
Yasi Klingler Avatar answered Oct 13 '22 11:10

Yasi Klingler