A little word cloud generator in Python

Overview

licence DOI

Linux macOS Windows
PyPI CircleCI TravisCI AppVeyor

word_cloud

A little word cloud generator in Python. Read more about it on the blog post or the website.

The code is tested against Python 2.7, 3.4, 3.5, 3.6 and 3.7.

Installation

If you are using pip:

pip install wordcloud

If you are using conda, you can install from the conda-forge channel:

conda install -c conda-forge wordcloud

Installation notes

wordcloud depends on numpy and pillow.

To save the wordcloud into a file, matplotlib can also be installed. See examples below.

If there are no wheels available for your version of python, installing the package requires having a C compiler set up. Before installing a compiler, report an issue describing the version of python and operating system being used.

Examples

Check out examples/simple.py for a short intro. A sample output is:

Constitution

Or run examples/masked.py to see more options. A sample output is:

Alice in Wonderland

Getting fancy with some colors: Parrot with rainbow colors

Generating wordclouds for Arabic:

Arabic wordlcloud

Command-line usage

The wordcloud_cli tool can be used to generate word clouds directly from the command-line:

$ wordcloud_cli --text mytext.txt --imagefile wordcloud.png

If you're dealing with PDF files, then pdftotext, included by default with many Linux distribution, comes in handy:

$ pdftotext mydocument.pdf - | wordcloud_cli --imagefile wordcloud.png

In the previous example, the - argument orders pdftotext to write the resulting text to stdout, which is then piped to the stdin of wordcloud_cli.py.

Use wordcloud_cli --help so see all available options.

Licensing

The wordcloud library is MIT licenced, but contains DroidSansMono.ttf, a true type font by Google, that is apache licensed. The font is by no means integral, and any other font can be used by setting the font_path variable when creating a WordCloud object.

Comments
  • Wordcloud fails to install with pip under Windows 10 Python 3.5 Anaconda

    Wordcloud fails to install with pip under Windows 10 Python 3.5 Anaconda

    > pip install wordcloud
    

    Collecting wordcloud Using cached wordcloud-1.2.1.tar.gz Building wheels for collected packages: wordcloud Running setup.py bdist_wheel for wordcloud Complete output from command C:\Anaconda3\python.exe -c "import setuptools;file='C:\Users\vaast\AppData\Local\Temp\pip-build-xepnqb1f\wordcloud\setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" bdist_wheel -d C:\Users\vaast\AppData\Local\Temp\tmp5d658m49pip-wheel-: running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-3.5 creating build\lib.win-amd64-3.5\wordcloud copying wordcloud\color_from_image.py -> build\lib.win-amd64-3.5\wordcloud copying wordcloud\wordcloud.py -> build\lib.win-amd64-3.5\wordcloud copying wordcloud\wordcloud_cli.py -> build\lib.win-amd64-3.5\wordcloud copying wordcloud__init__.py -> build\lib.win-amd64-3.5\wordcloud copying wordcloud\stopwords -> build\lib.win-amd64-3.5\wordcloud copying wordcloud\DroidSansMono.ttf -> build\lib.win-amd64-3.5\wordcloud running build_ext building 'wordcloud.query_integral_image' extension error: Unable to find vcvarsall.bat


    Failed building wheel for wordcloud Failed to build wordcloud Installing collected packages: wordcloud Running setup.py install for wordcloud Complete output from command C:\Anaconda3\python.exe -c "import setuptools, tokenize;file='C:\Users\vaast\AppData\Local\Temp\pip-build-xepnqb1f\wordcloud\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record C:\Users\vaast\AppData\Local\Temp\pip-lonpl8b1-record\install-record.txt --single-version-externally-managed --compile: running install running build running build_py running build_ext building 'wordcloud.query_integral_image' extension error: Unable to find vcvarsall.bat

    ----------------------------------------
    

    Command "C:\Anaconda3\python.exe -c "import setuptools, tokenize;file='C:\Users\vaast\AppData\Local\Temp\pip-build-xepnqb1f\wordcloud\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record C:\Users\vaast\AppData\Local\Temp\pip-lonpl8b1-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\vaast\AppData\Local\Temp\pip-build-xepnqb1f\wordcloud

    opened by vaastav 54
  • Value Error: ImageColorGenerator is smaller than the canvas

    Value Error: ImageColorGenerator is smaller than the canvas

    Description

    Hey I am definitely sure that my ImageColorGenerator is bigger than my canvas and I even tried to change the canvas width height to more and less but I am always getting this value error no matter what. Here is my code -

    Example:

    mask3 = np.array(Image.open(path.join(d, "test7.png")))
    wc = WordCloud(background_color="white", max_words=1000, mask=mask3,stopwords=q,
                   max_font_size=150, random_state=42)
    wc.generate(str4)
    # create coloring from image
    image_colors = ImageColorGenerator(mask3)
    print(image_colors.image.shape)
    print(wc.width, wc.height)
    plt.figure(figsize=[5,5])
    plt.tight_layout(pad=0)
    plt.imshow(wc.recolor(color_func=image_colors), interpolation="bilinear")
    plt.axis("off")
    plt.show()
    
    

    Explanation

    This Image test7 here is 800800 and I know that default canvas is 400200 I have another image which is 900*900 and that is working perfectly.

    Can you explain me as to how this is working and what is happening:

    output for test7 image ( the red thing with eyes)

    (800, 800, 4) 400 200

    Images

    This is the image with which it is working perfectly test1 This is the image which is showing error test7 This is the image to which I actually want to do it ultimately this image is 500*306 test8

    Please help

    opened by divyam28 38
  • Problem with query_integral_image + python 3

    Problem with query_integral_image + python 3

    I have tried to install wordcloud with Python 3.4 (OSX) and it seems I have some trouble with query_integral_image. The query_integral_image.so is present, but when I try to load it manually:

    ~/site-packages3/wordcloud (master)$ python3
    Python 3.4.1 (default, Aug 24 2014, 21:32:40)
    [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import query_integral_image
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "wordcloud/query_integral_image.pyx", line 3, in init wordcloud.query_integral_image (wordcloud/query_integral_image.c:13451)
    SystemError: Parent module '' not loaded, cannot perform relative import
    >>>
    
    ~/site-packages3/wordcloud (master)$ pip3 freeze
    Cython==0.21.1
    Jinja2==2.7.3
    MarkupSafe==0.23
    Pillow==2.6.1
    certifi==14.05.14
    gensim==0.10.3
    gnureadline==6.3.3
    humanize==0.5
    ipython==2.3.1
    lxml==3.4.0
    matplotlib==1.4.0
    nose==1.3.4
    numpy==1.8.2
    pandas==0.14.1
    pyparsing==2.0.2
    python-dateutil==2.2
    pytz==2014.7
    pyzmq==14.4.1
    scikit-learn==0.15.2
    scipy==0.14.0
    six==1.7.3
    tornado==4.0.2
    wordcloud==1.0.0
    
    opened by cjauvin 38
  • Word cloud unicode (multilanguage) problem

    Word cloud unicode (multilanguage) problem

    Hi, I am using your wordcloud script for one of my projects and I am working on several many languages together(i.e let's say tweets from different languages amalgamated into a single text file). Now when I use your script to create a tag cloud, it does not work well for unicode characters (arabic,etc). Is there a way to fix it ? Does it support multilanguage ?

    foreign languages support 
    opened by samemon 36
  • Instillation failed with Python 2.7.5, Anaconda 3.14, Windows 7

    Instillation failed with Python 2.7.5, Anaconda 3.14, Windows 7

    Hi,

    The installation failed with Python 2.7.5, Anaconda 3.14, Windows 7. The fail message is:

    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-2.7
    creating build\lib.win-amd64-2.7\wordcloud
    copying wordcloud\color_from_image.py -> build\lib.win-amd64-2.7\wordcloud
    copying wordcloud\wordcloud.py -> build\lib.win-amd64-2.7\wordcloud
    copying wordcloud\__init__.py -> build\lib.win-amd64-2.7\wordcloud
    copying wordcloud\stopwords -> build\lib.win-amd64-2.7\wordcloud
    copying wordcloud\DroidSansMono.ttf -> build\lib.win-amd64-2.7\wordcloud
    running build_ext
    building 'wordcloud/query_integral_image' extension
    creating build\temp.win-amd64-2.7
    creating build\temp.win-amd64-2.7\Release
    creating build\temp.win-amd64-2.7\Release\wordcloud
    C:\strawberry\c\bin\gcc.exe -DMS_WIN64 -mdll -O -Wall -IC:\Anaconda\include -IC:\Anaconda\PC -c wordcloud/query_integral_image.c -o build\temp.win-amd64-2.7\Release\wordcloud\query_integral_image.o
    wordcloud/query_integral_image.c: In function '__Pyx_RaiseArgtupleInvalid':
    wordcloud/query_integral_image.c:13681:18: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:13681:18: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'Py_ssize_t' [-Wformat]
    wordcloud/query_integral_image.c:13681:18: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:13681:18: warning: too many arguments for format [-Wformat-extra-args]
    wordcloud/query_integral_image.c: In function '__Pyx_BufFmt_ProcessTypeChunk':
    wordcloud/query_integral_image.c:14052:26: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:14052:26: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:14052:26: warning: too many arguments for format [-Wformat-extra-args]
    wordcloud/query_integral_image.c:14104:20: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:14104:20: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:14104:20: warning: too many arguments for format [-Wformat-extra-args]
    wordcloud/query_integral_image.c: In function '__pyx_buffmt_parse_array':
    wordcloud/query_integral_image.c:14166:25: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:14166:25: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat]
    wordcloud/query_integral_image.c:14166:25: warning: too many arguments for format [-Wformat-extra-args]
    wordcloud/query_integral_image.c: In function '__Pyx_GetBufferAndValidate':
    wordcloud/query_integral_image.c:14351:7: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:14351:7: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]
    wordcloud/query_integral_image.c:14351:7: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:14351:7: warning: too many arguments for format [-Wformat-extra-args]
    wordcloud/query_integral_image.c: In function '__Pyx_RaiseTooManyValuesError':
    wordcloud/query_integral_image.c:14882:18: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:14882:18: warning: too many arguments for format [-Wformat-extra-args]
    wordcloud/query_integral_image.c: In function '__Pyx_RaiseNeedMoreValuesError':
    wordcloud/query_integral_image.c:14888:18: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:14888:18: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]
    wordcloud/query_integral_image.c:14888:18: warning: too many arguments for format [-Wformat-extra-args]
    wordcloud/query_integral_image.c: In function '__Pyx_ValidateAndInit_memviewslice':
    wordcloud/query_integral_image.c:15644:22: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:15644:22: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]
    wordcloud/query_integral_image.c:15644:22: warning: unknown conversion type character 'z' in format [-Wformat]
    wordcloud/query_integral_image.c:15644:22: warning: too many arguments for format [-Wformat-extra-args]
    writing build\temp.win-amd64-2.7\Release\wordcloud\query_integral_image.def
    C:\strawberry\c\bin\gcc.exe -DMS_WIN64 -shared -s build\temp.win-amd64-2.7\Release\wordcloud\query_integral_image.o build\temp.win-amd64-2.7\Release\wordcloud\query_integral_image.def -LC:\Anaconda\libs -LC:\Anaconda\PCbuild\amd64 -lpython27 -lmsvcr90 -o build\lib.win-amd64-2.7\wordcloud\query_integral_image.pyd Cannot export initwordcloud/query_integral_image: symbol not defined
    collect2.exe: error: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1
    

    Any ideas?

    opened by joshlk 35
  • Deployement of wheels and website: Remaing tasks

    Deployement of wheels and website: Remaing tasks

    Remaining tasks are copied from https://github.com/amueller/word_cloud/pull/403:

    Once this is integrated, we could:

    • [x] enable flake8
    • [x] automatic deployment of the website on merge to master
    • [x] fix code and enable generation of wheels for python 3.7.
    enhancement 
    opened by jcfr 26
  • Failed to import wordcloud - DLL load failed

    Failed to import wordcloud - DLL load failed

    Hey,

    I am getting the error as below:

    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-14-dc1828f2a80e> in <module>()
    ----> 1 import wordcloud
    
    ~\AppData\Local\Continuum\anaconda3\lib\site-packages\wordcloud\__init__.py in <module>()
    ----> 1 from .wordcloud import (WordCloud, STOPWORDS, random_color_func,
          2                         get_single_color_func)
          3 from .color_from_image import ImageColorGenerator
          4 
          5 __all__ = ['WordCloud', 'STOPWORDS', 'random_color_func',
    
    ~\AppData\Local\Continuum\anaconda3\lib\site-packages\wordcloud\wordcloud.py in <module>()
         17 from operator import itemgetter
         18 
    ---> 19 from PIL import Image
         20 from PIL import ImageColor
         21 from PIL import ImageDraw
    
    ~\AppData\Local\Continuum\anaconda3\lib\site-packages\PIL\Image.py in <module>()
         56     # Also note that Image.core is not a publicly documented interface,
         57     # and should be considered private and subject to change.
    ---> 58     from . import _imaging as core
         59     if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
         60         raise ImportError("The _imaging extension was built for another "
    
    ImportError: DLL load failed: The specified module could not be found.
    
    opened by dushmshr 26
  • ImportError: No module named wordcloud

    ImportError: No module named wordcloud

    Hi there,

    I am attempting to use your wordcloud package but am having some trouble importing into my Python Notebook (I'm using Anaconda on Mac btw).

    I use the pip install wordcloud command and everything seems to run smoothly. It shows up in my /anaconda/lib/python2.7/site-packages folder.

    Now, when I go to my python notebook, I try to run import wordcloud and it gives me the error shown in the title.

    Any help would be much appreciated.

    opened by ghost 25
  • Add to_svg

    Add to_svg

    This is another tentative at vector file export. I initially did some experiments using freetype-py, but I was able to get the same results using Pillow bindings of FreeType (there are inconsistencies, though).

    There are however slight mismatches between rasterized and vector outputs. I also spotted inconsistencies using different browsers for some fonts (e.g. Segoe Script). I added an option (embed_image) to include the output of to_image in the SVG file, which is useful for debugging. I believe most differences are due to subtleties in kerning and ligatures, which is not significant in common fonts.

    It may also be useful to consider embedding the font file directly in the SVG file (or only the required subset, ideally). As my personal use case does not require fancy fonts, I did not dig any further on this topic. This means that using the default font will render properly only if Droid Sans Mono is available to the SVG reader.

    I have attached two modified examples, which use different fonts for portability.

    Also, contour is not implemented.

    Last but not least, I want to credit @jnothman and his pull request (in particular, his hack to detect font name/weight/style). As I am not fluent in forks and pull requests, I had to create a new pull request. But I would be glad to learn how to extend an existing pull request!

    opened by jojolebarjos 23
  • safe conda installation commands not working for 64bit machines Windows or Mac

    safe conda installation commands not working for 64bit machines Windows or Mac

    Past experience tells me it is best to use the conda installation commands where possible or your Anaconda environment can get corrupted. I tried both the conda and conda-forge installation commands on both my new MacBook Pro and my old Windows 7 64bit machines and in both cases got the error message "PackageNotFoundError" noting package not found in win-64 or osx-64 channels respectively. Can this be addressed?

    To help, these commands produced above error:

    On conda site provided here: https://anaconda.org/conda-forge/wordcloud conda install -c conda-forge wordcloud

    On your site tried the conda install path and it failed.

    I then gambled on doing a pip install on my old windows machine since it has multiple Anaconda Python 3.6 environments and got a slew of errors and the installation failed to go through. Error text from that failed installation:

    Command "C:\ProgramFilesCoders\Anaconda2\envs\PY36_clone\python.exe -u -c "impor t setuptools, tokenize;file='C:\Users\Mitch\AppData\Local\Temp\pip-bui ld-8tqklaya\wordcloud\setup.py';f=getattr(tokenize, 'open', open)(file);co de=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec') )" install --record C:\Users\Mitch\AppData\Local\Temp\pip-wahu2bsu-record\instal l-record.txt --single-version-externally-managed --compile" failed with error co de 1 in C:\Users\Mitch\AppData\Local\Temp\pip-build-8tqklaya\wordcloud\

    opened by TheMitchWorksPro 23
  • Failed building wheel for wordcloud

    Failed building wheel for wordcloud

    Trying to install wordcloud on windows 7. Getting the following error Failed to build wordcloud Installing collected packages: wordcloud Running setup.py install for wordcloud Complete output from command C:\Users\nitin.agarwal\AppData\Local\Continuum
    Anaconda3\python.exe -c "import setuptools, tokenize;file='C:\Users\NITIN~ 1.AGA\AppData\Local\Temp\pip-build-r2gzu169\wordcloud\setup.py';exec(compi le(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), fil e, 'exec'))" install --record C:\Users\NITIN~1.AGA\AppData\Local\Temp\pip-gdv7 89h9-record\install-record.txt --single-version-externally-managed --compile: running install running build running build_py running build_ext building 'wordcloud.query_integral_image' extension error: [WinError 2] The system cannot find the file specified

    ----------------------------------------
    

    Command "C:\Users\nitin.agarwal\AppData\Local\Continuum\Anaconda3\python.exe -c "import setuptools, tokenize;file='C:\Users\NITIN~1.AGA\AppData\Local\T emp\pip-build-r2gzu169\wordcloud\setup.py';exec(compile(getattr(tokenize, 'op en', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install - -record C:\Users\NITIN~1.AGA\AppData\Local\Temp\pip-gdv789h9-record\install-reco rd.txt --single-version-externally-managed --compile" failed with error code 1 i n C:\Users\NITIN~1.AGA\AppData\Local\Temp\pip-build-r2gzu169\wordcloud

    opened by agarnitin86 23
  • Bump wheel from 0.34.1 to 0.38.1

    Bump wheel from 0.34.1 to 0.38.1

    Bumps wheel from 0.34.1 to 0.38.1.

    Changelog

    Sourced from wheel's changelog.

    Release Notes

    UNRELEASED

    • Updated vendored packaging to 22.0

    0.38.4 (2022-11-09)

    • Fixed PKG-INFO conversion in bdist_wheel mangling UTF-8 header values in METADATA (PR by Anderson Bravalheri)

    0.38.3 (2022-11-08)

    • Fixed install failure when used with --no-binary, reported on Ubuntu 20.04, by removing setup_requires from setup.cfg

    0.38.2 (2022-11-05)

    • Fixed regression introduced in v0.38.1 which broke parsing of wheel file names with multiple platform tags

    0.38.1 (2022-11-04)

    • Removed install dependency on setuptools
    • The future-proof fix in 0.36.0 for converting PyPy's SOABI into a abi tag was faulty. Fixed so that future changes in the SOABI will not change the tag.

    0.38.0 (2022-10-21)

    • Dropped support for Python < 3.7
    • Updated vendored packaging to 21.3
    • Replaced all uses of distutils with setuptools
    • The handling of license_files (including glob patterns and default values) is now delegated to setuptools>=57.0.0 (#466). The package dependencies were updated to reflect this change.
    • Fixed potential DoS attack via the WHEEL_INFO_RE regular expression
    • Fixed ValueError: ZIP does not support timestamps before 1980 when using SOURCE_DATE_EPOCH=0 or when on-disk timestamps are earlier than 1980-01-01. Such timestamps are now changed to the minimum value before packaging.

    0.37.1 (2021-12-22)

    • Fixed wheel pack duplicating the WHEEL contents when the build number has changed (#415)
    • Fixed parsing of file names containing commas in RECORD (PR by Hood Chatham)

    0.37.0 (2021-08-09)

    • Added official Python 3.10 support
    • Updated vendored packaging library to v20.9

    ... (truncated)

    Commits
    • 6f1608d Created a new release
    • cf8f5ef Moved news item from PR #484 to its proper place
    • 9ec2016 Removed install dependency on setuptools (#483)
    • 747e1f6 Fixed PyPy SOABI parsing (#484)
    • 7627548 [pre-commit.ci] pre-commit autoupdate (#480)
    • 7b9e8e1 Test on Python 3.11 final
    • a04dfef Updated the pypi-publish action
    • 94bb62c Fixed docs not building due to code style changes
    • d635664 Updated the codecov action to the latest version
    • fcb94cd Updated version to match the release
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • [MNT] - Update README for list of tested python versions

    [MNT] - Update README for list of tested python versions

    The README is a bit out of date with the current tested versions, and in the current version implies that the module still is tested on / supports Python2, which I think is no longer the case (?). This update lists the current set of tested Python versions, drawing from the Github actions file.

    In addition, there is a minor update to the install section of the README to note that matplotlib is now a required dependency (it previously stated it was optional, but I believe this is outdated).

    opened by TomDonoghue 0
  • Wheel missing for cpython-311 win-amd64

    Wheel missing for cpython-311 win-amd64

    Description

    Installation results in building wheel, which fails because of missing Microsoft C++ Build Tools.

    This report is done according to README (If there are no wheels available for your version of python, installing the package requires having a C compiler set up. Before installing a compiler, report an issue describing the version of python and operating system being used.)

    Python version: 3.11.1 Windows version: Win 10 Pro, Version 21H2 wordcloud version: 1.8.2.2

    Steps/Code to Reproduce

    PS C:> python -V Python 3.11.1

    PS C:> pip install wordcloud Collecting wordcloud Using cached wordcloud-1.8.2.2.tar.gz (220 kB) Preparing metadata (setup.py) ... done Requirement already satisfied: numpy>=1.6.1 in c:\users\hendonk\python3\lib\site-packages (from wordcloud) (1.23.5) Requirement already satisfied: pillow in c:\users\hendonk\python3\lib\site-packages (from wordcloud) (9.3.0) Requirement already satisfied: matplotlib in c:\users\hendonk\python3\lib\site-packages (from wordcloud) (3.6.2) Requirement already satisfied: contourpy>=1.0.1 in c:\users\hendonk\python3\lib\site-packages (from matplotlib->wordcloud) (1.0.6) Requirement already satisfied: cycler>=0.10 in c:\users\hendonk\python3\lib\site-packages (from matplotlib->wordcloud) (0.11.0) Requirement already satisfied: fonttools>=4.22.0 in c:\users\hendonk\python3\lib\site-packages (from matplotlib->wordcloud) (4.38.0) Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\hendonk\python3\lib\site-packages (from matplotlib->wordcloud) (1.4.4) Requirement already satisfied: packaging>=20.0 in c:\users\hendonk\python3\lib\site-packages (from matplotlib->wordcloud) (22.0) Requirement already satisfied: pyparsing>=2.2.1 in c:\users\hendonk\python3\lib\site-packages (from matplotlib->wordcloud) (3.0.9) Requirement already satisfied: python-dateutil>=2.7 in c:\users\hendonk\python3\lib\site-packages (from matplotlib->wordcloud) (2.8.2) Requirement already satisfied: six>=1.5 in c:\users\hendonk\python3\lib\site-packages (from python-dateutil>=2.7->matplotlib->wordcloud) (1.16.0) Building wheels for collected packages: wordcloud Building wheel for wordcloud (setup.py) ... error error: subprocess-exited-with-error

    × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [20 lines of output] running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-cpython-311 creating build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\color_from_image.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\tokenization.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\wordcloud.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\wordcloud_cli.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud_version.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud_init_.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud_main_.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\stopwords -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\DroidSansMono.ttf -> build\lib.win-amd64-cpython-311\wordcloud UPDATING build\lib.win-amd64-cpython-311\wordcloud/_version.py set build\lib.win-amd64-cpython-311\wordcloud/_version.py to '1.8.2.2' 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/ [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for wordcloud Running setup.py clean for wordcloud Failed to build wordcloud Installing collected packages: wordcloud Running setup.py install for wordcloud ... error error: subprocess-exited-with-error

    × Running setup.py install for wordcloud did not run successfully. │ exit code: 1 ╰─> [22 lines of output] running install C:\users\hendonk\Python3\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_py creating build creating build\lib.win-amd64-cpython-311 creating build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\color_from_image.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\tokenization.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\wordcloud.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\wordcloud_cli.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud_version.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud_init_.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud_main_.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\stopwords -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\DroidSansMono.ttf -> build\lib.win-amd64-cpython-311\wordcloud UPDATING build\lib.win-amd64-cpython-311\wordcloud/_version.py set build\lib.win-amd64-cpython-311\wordcloud/_version.py to '1.8.2.2' 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/ [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure

    × Encountered error while trying to install package. ╰─> wordcloud

    note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.

    Expected Results

    Pip using wheel for installation, C compiler not necessary.

    Actual Results

    Wheel not found on PyPi, installation resorts to building wheel, fails because of missing C compiler.

    opened by Hendonk 0
  • Solution to Issue 274

    Solution to Issue 274

    Solution to ZeroDivisionError The file named issue274_resolved.py has a sample code showing how the word "funny" and "not funny" can be incorporated in wordcloud simultaneously.

    opened by Prashiksha 0
  • Not installing on windows 11 with python 3.11

    Not installing on windows 11 with python 3.11

    Microsoft Windows [Version 10.0.22621.900] (c) Microsoft Corporation. All rights reserved.

    C:\Users\Burhan>python -V Python 3.11.0

    C:\Users\Burhan>pip install wordcloud Collecting wordcloud Using cached wordcloud-1.8.2.2.tar.gz (220 kB) Preparing metadata (setup.py) ... done Requirement already satisfied: numpy>=1.6.1 in d:\python\lib\site-packages (from wordcloud) (1.23.5) Requirement already satisfied: pillow in d:\python\lib\site-packages (from wordcloud) (9.3.0) Requirement already satisfied: matplotlib in d:\python\lib\site-packages (from wordcloud) (3.6.2) Requirement already satisfied: contourpy>=1.0.1 in d:\python\lib\site-packages (from matplotlib->wordcloud) (1.0.6) Requirement already satisfied: cycler>=0.10 in d:\python\lib\site-packages (from matplotlib->wordcloud) (0.11.0) Requirement already satisfied: fonttools>=4.22.0 in d:\python\lib\site-packages (from matplotlib->wordcloud) (4.38.0) Requirement already satisfied: kiwisolver>=1.0.1 in d:\python\lib\site-packages (from matplotlib->wordcloud) (1.4.4) Requirement already satisfied: packaging>=20.0 in d:\python\lib\site-packages (from matplotlib->wordcloud) (21.3) Requirement already satisfied: pyparsing>=2.2.1 in d:\python\lib\site-packages (from matplotlib->wordcloud) (3.0.9) Requirement already satisfied: python-dateutil>=2.7 in d:\python\lib\site-packages (from matplotlib->wordcloud) (2.8.2) Requirement already satisfied: six>=1.5 in d:\python\lib\site-packages (from python-dateutil>=2.7->matplotlib->wordcloud) (1.16.0) Building wheels for collected packages: wordcloud Building wheel for wordcloud (setup.py) ... error error: subprocess-exited-with-error

    × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [26 lines of output] running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-cpython-311 creating build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\color_from_image.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\tokenization.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\wordcloud.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\wordcloud_cli.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud_version.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud_init_.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud_main_.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\stopwords -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\DroidSansMono.ttf -> build\lib.win-amd64-cpython-311\wordcloud UPDATING build\lib.win-amd64-cpython-311\wordcloud/_version.py set build\lib.win-amd64-cpython-311\wordcloud/_version.py to '1.8.2.2' running build_ext building 'wordcloud.query_integral_image' extension creating build\temp.win-amd64-cpython-311 creating build\temp.win-amd64-cpython-311\Release creating build\temp.win-amd64-cpython-311\Release\wordcloud d:\microsoft\visual_studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -ID:\python\include -ID:\python\Include -Id:\microsoft\visual_studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include -Id:\microsoft\visual_studio\2022\BuildTools\VC\Auxiliary\VS\include "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" /Tcwordcloud/query_integral_image.c /Fobuild\temp.win-amd64-cpython-311\Release\wordcloud/query_integral_image.obj query_integral_image.c wordcloud/query_integral_image.c(196): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory error: command 'd:\microsoft\visual_studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe' failed with exit code 2 [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for wordcloud Running setup.py clean for wordcloud Failed to build wordcloud Installing collected packages: wordcloud Running setup.py install for wordcloud ... error error: subprocess-exited-with-error

    × Running setup.py install for wordcloud did not run successfully. │ exit code: 1 ╰─> [28 lines of output] running install D:\python\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_py creating build creating build\lib.win-amd64-cpython-311 creating build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\color_from_image.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\tokenization.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\wordcloud.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\wordcloud_cli.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud_version.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud_init_.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud_main_.py -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\stopwords -> build\lib.win-amd64-cpython-311\wordcloud copying wordcloud\DroidSansMono.ttf -> build\lib.win-amd64-cpython-311\wordcloud UPDATING build\lib.win-amd64-cpython-311\wordcloud/_version.py set build\lib.win-amd64-cpython-311\wordcloud/_version.py to '1.8.2.2' running build_ext building 'wordcloud.query_integral_image' extension creating build\temp.win-amd64-cpython-311 creating build\temp.win-amd64-cpython-311\Release creating build\temp.win-amd64-cpython-311\Release\wordcloud d:\microsoft\visual_studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -ID:\python\include -ID:\python\Include -Id:\microsoft\visual_studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include -Id:\microsoft\visual_studio\2022\BuildTools\VC\Auxiliary\VS\include "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" /Tcwordcloud/query_integral_image.c /Fobuild\temp.win-amd64-cpython-311\Release\wordcloud/query_integral_image.obj query_integral_image.c wordcloud/query_integral_image.c(196): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory error: command 'd:\microsoft\visual_studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe' failed with exit code 2 [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure

    × Encountered error while trying to install package. ╰─> wordcloud

    note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.

    opened by burhankhanzada 7
  • Architectural problems importing with M1 Mac.

    Architectural problems importing with M1 Mac.

    Description

    Troubles importing wordcloud, could that be an M1 issue?

    Steps/Code to Reproduce

    Code:

    from wordcloud import WordCloud
    import matplotlib.pyplot as plt
    from PIL import Image
    import numpy as np
    
    text = ("Data science is an interdisciplinary field that uses scientific methods, processes, algorithms and systems to extract knowledge and insights from data in various forms, both structured and unstructured, similar to data")
    
    wordcloud = WordCloud(width=1280, height=853, margin=0,
                          colormap='Blues').generate(text)
    
    plt.imshow(wordcloud, interpolation='bilinear')
    plt.axis('off')
    plt.margins(x=0, y=0)
    plt.show()
    

    If the code is too long, feel free to put it in a public gist and link it in the issue: https://gist.github.com -->

    Expected Results

    Actual Results (Error)

    error-wc

    Versions

    versions-wc
    opened by mkacki98 1
Releases(1.5.0)
Owner
Andreas Mueller
Scikit-learn core-developer, Principal Research SDE @microsoft
Andreas Mueller
Wikipedia WordCloud App generate Wikipedia word cloud art created using python's streamlit, matplotlib, wikipedia and wordcloud packages

Wikipedia WordCloud App Wikipedia WordCloud App generate Wikipedia word cloud art created using python's streamlit, matplotlib, wikipedia and wordclou

Siva Prakash 5 Jan 2, 2022
Farhad Davaripour, Ph.D. 1 Jan 5, 2022
A little logger for machine learning research

dowel dowel is a little logger for machine learning research. Installation pip install dowel Usage import dowel from dowel import logger, tabular log

Reinforcement Learning Working Group 27 Dec 3, 2022
Visual Python is a GUI-based Python code generator, developed on the Jupyter Notebook environment as an extension.

Visual Python is a GUI-based Python code generator, developed on the Jupyter Notebook environment as an extension.

Visual Python 564 Jan 3, 2023
:art: Diagram as Code for prototyping cloud system architectures

Diagrams Diagram as Code. Diagrams lets you draw the cloud system architecture in Python code. It was born for prototyping a new system architecture d

MinJae Kwon 27.5k Dec 30, 2022
Some method of processing point cloud

Point-Cloud Some method of processing point cloud inversion the completion pointcloud to incomplete point cloud Some model of encoding point cloud to

Tan 1 Nov 19, 2021
Pyan3 - Offline call graph generator for Python 3

Pyan takes one or more Python source files, performs a (rather superficial) static analysis, and constructs a directed graph of the objects in the combined source, and how they define or use each other. The graph can be output for rendering by GraphViz or yEd.

Juha Jeronen 235 Jan 2, 2023
A Python-based non-fungible token (NFT) generator built using Samilla and Matplotlib

PyNFT A Pythonic NF (non-fungible token) generator built using Samilla and Matplotlib Use python pynft.py [amount] The intention behind this generato

Ayush Gundawar 6 Feb 7, 2022
An easy to use burndown chart generator for GitHub Project Boards.

Burndown Chart for GitHub Projects An easy to use burndown chart generator for GitHub Project Boards. Table of Contents Features Installation Assumpti

Joseph Hale 15 Dec 28, 2022
Simple plotting for Python. Python wrapper for D3xter - render charts in the browser with simple Python syntax.

PyDexter Simple plotting for Python. Python wrapper for D3xter - render charts in the browser with simple Python syntax. Setup $ pip install PyDexter

D3xter 31 Mar 6, 2021
A Python Binder that merge 2 files with any extension by creating a new python file and compiling it to exe which runs both payloads.

Update ! ANONFILE MIGHT NOT WORK ! About A Python Binder that merge 2 files with any extension by creating a new python file and compiling it to exe w

Vesper 15 Oct 12, 2022
Declarative statistical visualization library for Python

Altair http://altair-viz.github.io Altair is a declarative statistical visualization library for Python. With Altair, you can spend more time understa

Altair 8k Jan 5, 2023
Interactive Data Visualization in the browser, from Python

Bokeh is an interactive visualization library for modern web browsers. It provides elegant, concise construction of versatile graphics, and affords hi

Bokeh 17.1k Dec 31, 2022
Cartopy - a cartographic python library with matplotlib support

Cartopy is a Python package designed to make drawing maps for data analysis and visualisation easy. Table of contents Overview Get in touch License an

null 1.2k Jan 1, 2023
A grammar of graphics for Python

plotnine Latest Release License DOI Build Status Coverage Documentation plotnine is an implementation of a grammar of graphics in Python, it is based

Hassan Kibirige 3.3k Jan 1, 2023
a plottling library for python, based on D3

Hello August 2013 Hello! Maybe you're looking for a nice Python interface to build interactive, javascript based plots that look as nice as all those

Mike Dewar 1.4k Dec 28, 2022
UNMAINTAINED! Renders beautiful SVG maps in Python.

Kartograph is not maintained anymore As you probably already guessed from the commit history in this repo, Kartograph.py is not maintained, which mean

null 1k Dec 9, 2022
Tools for writing, submitting, debugging, and monitoring Storm topologies in pure Python

Petrel Tools for writing, submitting, debugging, and monitoring Storm topologies in pure Python. NOTE: The base Storm package provides storm.py, which

AirSage 247 Dec 18, 2021
The Python ensemble sampling toolkit for affine-invariant MCMC

emcee The Python ensemble sampling toolkit for affine-invariant MCMC emcee is a stable, well tested Python implementation of the affine-invariant ense

Dan Foreman-Mackey 1.3k Jan 4, 2023