Modulenotfounderror: No module named 'wordcloud'

Asked

Viewed 1,709 times

1

I’m using the Microsoft Azure with Jupyter notebook and I need to use the word cloud. However when executing the code: from wordcloud import WordCloud it presents the error

No module named 'wordcloud'

See image: inserir a descrição da imagem aqui

  • 1

    At the root of the project by the terminal you run the commands that the user below posted as response. pip install wordcloud. Try running as an administrator.

  • It didn’t work either :/

  • 1

    You checked if the libs pillow and numpy are installed? They are dependencies.

  • I actually installed them

  • error while installing Pillow.. Installing collected Packages: Pillow Exception: Traceback (Most recent call last): File "/usr/local/lib/python3.5/dist-Packages/Pip/basecommand.py", line 215, in main status = self.run(options, args) File "/usr/local/lib/python3.5/dist-Packages/Pip/Commands/install.py", line 342, in run prefix=options.prefix_path, File "/usr/local/lib/python3.5/dist-Packages/Pip/req/req_py.", line 784, install in **kwargs ........... CONTINUES

  • File "/usr/local/lib/python3.5/dist-Packages/Pip/req/req_install.py", line 851, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) File "/usr/local/lib/python3.5/dist-Packages/Pip/req/req_install.py", line 1064, inmove_wheel_&#Xa files; isolated=self.isolated,
 File "/usr/local/lib/python3.5/dist-packages/pip/wheel.py", line 345, in move_wheel_files
 clobber(source, lib_dir, True)
 File "/usr/local/lib/python3.5/dist-packages/pip/wheel.py", line 316, in clobber
 ensure_dir(destdir) ........................ CONTINUES

  • File "/usr/local/lib/python3.5/dist-Packages/Pip/utils/init.py", line 83, in ensure_dir os.makedirs(path) File "/usr/lib/python3.5/os.py", line 241, in makedirs mkdir(name, mode) Permissionerror: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-Packages/PIL'

  • 1

    So, it looks like permission error. Try running sudo or if you are using windows, open CMD with admin permission.

  • 1

    I managed to play here, I will post the answer.

Show 4 more comments

2 answers

1

First, on the root page of your project, where your Python script is Terminal right-hand.

Lista de Projetos

Then type ls. As in the image below, some versions may appear Anaconda. Choose the one you are using and in the same place you typed ls typhoon source anaconda3_501/bin/activate.

inserir a descrição da imagem aqui

Done that, in front of your user, in my case nbuser, will appear (groundwork).

Now do the command: pip install wordcloud. Dependencies will be installed.

After you’re done, with the terminal screen open, open another browser tab with your Python script, and click Kernel > Change Kernel....

inserir a descrição da imagem aqui

On the screen that opens choose the terminal you are in session:

inserir a descrição da imagem aqui

Run the script again and see if it works.

  • It wasn’t.. Note: I think it might be because you’re using Jupyterlab and I’m using Microsoft Azure. I don’t know if that’s why.. but follow the error.............................. Collecting wordcloud
 Downloading https://files.pythonhosted.org/packages/5e/b7/c16286efa3d442d6983b3842f982502c00306c1a4c719c41fb00d6017c77/wordcloud-1.5.0-cp35-cp35m-manylinux1_x86_64.whl (357kB)
 100% |████████████████████████████████| 358kB 320kB/s

  • Collecting pillow (from wordcloud)
 Downloading https://files.pythonhosted.org/packages/8b/e9/5c47710fe383f0582da668302a80a6355fe15c2ce2dde89b50fe34acefa6/Pillow-5.4.1-cp35-cp35m-manylinux1_x86_64.whl (2.0MB)
 100% |████████████████████████████████| 2.0MB 62kB/s
Collecting numpy>=1.6.1 (from wordcloud) Cache entry deserialization failed, entry Ignored Downloading https://files.pythonhosted.org/packages/ad/15/690c13ae714e156491392cdbdbf41b485d23c285aa698239a67f7cfc9e0a/numpy-1.16.1-cp35m-manylinux1_x86_64.whl (17.2MB)
 100% |████████████████████████████████| 17.2MB 5.8kB/s

  • Installing collected Packages: Pillow, numpy, wordcloud Exception: Traceback (Most recent call last): File "/usr/local/lib/python3.5/dist-Packages/Pip/basecommand.py", line 215, in main status = self.run(options, args) File "/usr/local/lib/python3.5/dist-Packages/Pip/Commands/install.py", line 342, in run prefix=options.prefix_path, File "/usr/local/lib/python3.5/dist-Packages/Pip/req/req_py.", line 784, install **kwargs

  • File "/usr/local/lib/python3.5/dist-Packages/Pip/req/req_install.py", line 851, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) File "/usr/local/lib/python3.5/dist-Packages/Pip/req/req_install.py", line 1064, inmove_wheel_&#Xa files; isolated=self.isolated,
 File "/usr/local/lib/python3.5/dist-packages/pip/wheel.py", line 345, in move_wheel_files
 clobber(source, lib_dir, True)
 File "/usr/local/lib/python3.5/dist-packages/pip/wheel.py", line 316, in clobber
 ensure_dir(destdir)

  • File "/usr/local/lib/python3.5/dist-Packages/Pip/utils/init.py", line 83, in ensure_dir os.makedirs(path) File "/usr/lib/python3.5/os.py", line 241, in makedirs mkdir(name, mode) Permissionerror: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-Packages/PIL' You are using Pip version 9.0.1, However version 19.0.2 is available. You should consider upgrading via the 'Pip install --upgrade Pip' command.

  • What exactly are you using? Python Version, Software...

Show 1 more comment

0

Try

python -m pip install wordcloud

you’ll probably need to numpy and pillow too

If another problem does not work it may be that you have more than 1 python installed, what to do is

caminho/para/python -m pip install wordcloud

You can try too

 !conda install wordcloud -y
  • I did it, but the error remains.

  • Any other suggestions? Note: Thank you for trying to help me :)

  • Did it at the IDE terminal or OS terminal?

  • At the IDE terminal

  • I really don’t know, all the problems of modules not found are pq not installed, the last solution I have up my sleeve is to create a new Nvironment, see this example in Conda: Conda create --name [name] wordcloud

  • What is this? x "Nvironment " ?

  • I don’t know the IDE you are using but it must be something similar

  • Environment is where you write the code, simply create a new file only I forced wordcloud right at creation

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.