0
votes

I was working with sentiment analysis today, and when i started importing libraries i am unable to install wordcloud. it gives me an error as follows when i try to install pip install wordcloud. i also tried to install it by downloading it and copying it to my current directory and python -m pip install wordcloud-1.8.1-cp38-cp38-win_amd64.whl but that does not work too.

i.e. i am using windows, vscode and python3.9

The log error is

PS E:\projects\python\sentiment> pip install wordcloud

Collecting wordcloud Using cached wordcloud-1.8.1.tar.gz (220 kB) Requirement already satisfied: numpy>=1.6.1 in c:\users\robel\appdata\local\programs\python\python39\lib\site-packages (from wordcloud) (1.20.3) Requirement already satisfied: pillow in c:\users\robel\appdata\local\programs\python\python39\lib\site-packages (from wordcloud) (8.2.0) Requirement already satisfied: matplotlib in c:\users\robel\appdata\local\programs\python\python39\lib\site-packages (from wordcloud) (3.4.2)
Requirement already satisfied: pyparsing>=2.2.1 in c:\users\robel\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (2.4.7) Requirement already satisfied: cycler>=0.10 in c:\users\robel\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (0.10.0) Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\robel\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (1.3.1) Requirement already satisfied: python-dateutil>=2.7 in c:\users\robel\appdata\local\programs\python\python39\lib\site-packages (from matplotlib->wordcloud) (2.8.1) Requirement already satisfied: six in c:\users\robel\appdata\local\programs\python\python39\lib\site-packages (from cycler>=0.10->matplotlib->wordcloud) (1.16.0) Using legacy 'setup.py install' for wordcloud, since package 'wheel' is not installed. Installing collected packages: wordcloud Running setup.py install for wordcloud ... error ERROR: Command errored out with exit status 1: command: 'c:\users\robel\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Robel\AppData\Local\Temp\pip-install-ij5wisei\wordcloud_65d6145d63024c6693ae2f4a8a7fb0a8\setup.py'"'"'; file='"'"'C:\Users\Robel\AppData\Local\Temp\pip-install-ij5wisei\wordcloud_65d6145d63024c6693ae2f4a8a7fb0a8\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Robel\AppData\Local\Temp\pip-record-ppnm2m4u\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\robel\appdata\local\programs\python\python39\Include\wordcloud' cwd: C:\Users\Robel\AppData\Local\Temp\pip-install-ij5wisei\wordcloud_65d6145d63024c6693ae2f4a8a7fb0a8
Complete output (20 lines): running install running build running build_py creating build creating build\lib.win-amd64-3.9 creating build\lib.win-amd64-3.9\wordcloud copying wordcloud\color_from_image.py -> build\lib.win-amd64-3.9\wordcloud copying wordcloud\tokenization.py -> build\lib.win-amd64-3.9\wordcloud copying wordcloud\wordcloud.py -> build\lib.win-amd64-3.9\wordcloud copying wordcloud\wordcloud_cli.py -> build\lib.win-amd64-3.9\wordcloud copying wordcloud_version.py -> build\lib.win-amd64-3.9\wordcloud copying wordcloud_init_.py -> build\lib.win-amd64-3.9\wordcloud copying wordcloud_main_.py -> build\lib.win-amd64-3.9\wordcloud copying wordcloud\stopwords -> build\lib.win-amd64-3.9\wordcloud copying wordcloud\DroidSansMono.ttf -> build\lib.win-amd64-3.9\wordcloud UPDATING build\lib.win-amd64-3.9\wordcloud/_version.py set build\lib.win-amd64-3.9\wordcloud/_version.py to '1.8.1' running build_ext building 'wordcloud.query_integral_image' extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ ---------------------------------------- ERROR: Command errored out with exit status 1: 'c:\users\robel\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Robel\AppData\Local\Temp\pip-install-ij5wisei\wordcloud_65d6145d63024c6693ae2f4a8a7fb0a8\setup.py'"'"'; file='"'"'C:\Users\Robel\AppData\Local\Temp\pip-install-ij5wisei\wordcloud_65d6145d63024c6693ae2f4a8a7fb0a8\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Robel\AppData\Local\Temp\pip-record-ppnm2m4u\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\robel\appdata\local\programs\python\python39\Include\wordcloud' Check the logs for full command output.

2
Do you gave Microsoft Visual C++ 14.0 or greater installed? Is it on your PATH?doctorlove

2 Answers

1
votes

Try installed worcloud by .whl file.

Choose the version that suit for you. Wordcloud.whl

Use cmd and type this command:

step 1

cd *your file directory path*

step 2

pip install *the file name.whl*
0
votes

The problem is that wordcloud has no prebuilt wheels for python3.9 on windows. Therefore when you install it it will download the source code and try to build the wheel. In order to successfully build this wheel you need a c compiler.

As the error suggests you can download Microsoft C++ Build Tools.

After downloading and installing (make sure you have the correct version between 32 and 64 bit depending on your python architecture) then retry doing pip install wordcloud