Andrew Smith
Andrew Smith

Reputation: 571

Installing wordcloud using Jupyter Notebook

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?

Upvotes: 10

Views: 70202

Answers (12)

Abu Bakar Siddik
Abu Bakar Siddik

Reputation: 459

As you are using Jupyter Notebook. Try using following these commands in Anaconda prompt. It will work fine.

conda install -c conda-forge wordcloud
conda install -c conda-forge/label/gcc7 wordcloud
conda install -c conda-forge/label/cf201901 wordcloud
conda install -c conda-forge/label/cf202003 wordcloud

Upvotes: 0

Thiru Balaji G
Thiru Balaji G

Reputation: 193

Try this on Jupyter cell:

!pip install wordcloud

Upvotes: 12

Sravani Tholam
Sravani Tholam

Reputation: 1

open anaconda prompt and enter

pip install wordcloud

Then go to jupyter and write

from wordcloud import WordCloud

Upvotes: 0

sourav
sourav

Reputation: 41

After installing wordcloud using pip python -m pip install wordcloud, its working fine in jupyter Notebook.

pip install wordcloud

Upvotes: 0

Gth lala
Gth lala

Reputation: 322

to install wordcloud - execute "pip install wordcloud" from Anaconda prompt (not cmd)

Upvotes: 0

Max
Max

Reputation: 1

I had the same issue, had to make a new conda environment and then installed it. (https://conda.io/docs/user-guide/getting-started.html)

"1.Create a new environment and install a package in it. We will name the environment snowflakes and install the package wordcloud. At the Anaconda Prompt or in your Terminal window, type the following:"

conda create --name snowflakes wordcloud

Upvotes: 0

prashanthjoshua
prashanthjoshua

Reputation: 21

open anaconda prompt and enter

python -m pip install wordcloud

Upvotes: 2

Yasi Klingler
Yasi Klingler

Reputation: 636

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

Upvotes: 7

Wender
Wender

Reputation: 1001

Before install libpython3-dev

$ sudo apt-get install libpython3-dev
$ sudo pip install wordcloud

Upvotes: -1

Radioactive
Radioactive

Reputation: 769

I am hoping that you might be using MAC. In that case, check if word cloud got installed in the same place where conda is.

In my case, running it on python3 was working fine but running it on Anaconda was giving an import error.

These are steps that I followed to resolve the issue:

  1. Open the conda terminal from the application. If you are having problems (such as process completed) check whether you are using bash or zsh. Currently conda terminal is supported only on bash. You can change the default shell using the below commands:

Use: chsh -s /bin/bash to change the shell from zsh to bash.

Use: chsh -s /bin/zsh to revert back to zsh later.

  1. Once changed to bash, install word cloud for anaconda using the below command:

conda install -c conda-forge wordcloud

Voila! Your imports should work now, just as mine did.

Upvotes: 0

achille
achille

Reputation: 661

Try installing using conda after activating the environment that contains numpy and pillow. Make sure your code is running in that environment.

conda install -c conda-forge wordcloud=1.2.1

Other sources available on anaconda

Upvotes: 2

Harald Nordgren
Harald Nordgren

Reputation: 12399

Try

python -m pip install wordcloud

You probably need numpy and pillow as well.

Upvotes: 16

Related Questions