Reputation: 571
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
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
Reputation: 1
open anaconda prompt and enter
pip install wordcloud
Then go to jupyter and write
from wordcloud import WordCloud
Upvotes: 0
Reputation: 41
After installing wordcloud using pip python -m pip install wordcloud
, its working fine in jupyter Notebook.
Upvotes: 0
Reputation: 322
to install wordcloud - execute "pip install wordcloud" from Anaconda prompt (not cmd)
Upvotes: 0
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
Reputation: 21
open anaconda prompt and enter
python -m pip install wordcloud
Upvotes: 2
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
Reputation: 1001
Before install libpython3-dev
$ sudo apt-get install libpython3-dev
$ sudo pip install wordcloud
Upvotes: -1
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:
Use: chsh -s /bin/bash to change the shell from zsh to bash.
Use: chsh -s /bin/zsh to revert back to zsh later.
conda install -c conda-forge wordcloud
Voila! Your imports should work now, just as mine did.
Upvotes: 0
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
Reputation: 12399
Try
python -m pip install wordcloud
You probably need numpy
and pillow
as well.
Upvotes: 16