{"id":2845,"library":"wordcloud","title":"WordCloud","description":"WordCloud is a Python library for generating visual representations of text data, commonly known as word clouds or tag clouds. It takes text as input and visualizes the most frequent words, with the size of each word indicating its frequency. The library is actively maintained, with frequent updates, and focuses on efficient algorithms, flexible masking, and filling available space. The current version is 1.9.6.","status":"active","version":"1.9.6","language":"en","source_language":"en","source_url":"https://github.com/amueller/word_cloud","tags":["visualization","text analysis","nlp","word cloud","data visualization"],"install":[{"cmd":"pip install wordcloud","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for numerical operations, especially image manipulation and array handling.","package":"numpy"},{"reason":"Required for image processing, including creating and manipulating mask images.","package":"pillow"},{"reason":"Commonly used for displaying the generated word cloud images.","package":"matplotlib"}],"imports":[{"note":"Importing 'wordcloud' directly instead of 'WordCloud' class is a common mistake, leading to 'module' object not callable errors.","wrong":"import wordcloud","symbol":"WordCloud","correct":"from wordcloud import WordCloud"}],"quickstart":{"code":"from wordcloud import WordCloud\nimport matplotlib.pyplot as plt\n\n# Sample text data\ntext = \"Python programming is fun. Python is great for data science. Data visualization with Python is powerful.\"\n\n# Create a WordCloud object\nwordcloud = WordCloud(width=800, height=400, background_color='white').generate(text)\n\n# Display the generated image:\nplt.figure(figsize=(10, 5))\nplt.imshow(wordcloud, interpolation='bilinear')\nplt.axis('off') # Turn off axes for a cleaner look\nplt.title('My First Word Cloud')\nplt.show()","lang":"python","description":"This quickstart generates a basic word cloud from a sample string and displays it using Matplotlib. It demonstrates the core `WordCloud` class instantiation, text generation, and image display."},"warnings":[{"fix":"Ensure you have a C compiler installed (e.g., build-essential on Linux, Xcode command-line tools on macOS, Visual C++ Build Tools on Windows) or check for compatible pre-built wheels for your environment.","message":"Installation can fail if a pre-built wheel is not available for your specific Python version and operating system. This is because `wordcloud` includes some C code that requires a C compiler to build if a wheel is not found.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Check the `wordcloud` GitHub issues for updates and potential fixes. If encountering issues, try downgrading `matplotlib` to a known compatible version (e.g., 3.8.x) or upgrading `wordcloud` to its latest version (1.9.6 or newer) which might include a fix.","message":"There have been reports of incompatibility with `matplotlib` version 3.9.0. Users might encounter issues when trying to display word clouds with this specific `matplotlib` version.","severity":"breaking","affected_versions":"Potentially wordcloud < 1.9.6 with matplotlib 3.9.0+"},{"fix":"Always include `plt.axis('off')` before `plt.show()` when displaying a `wordcloud` image with `matplotlib`.","message":"When displaying word clouds using `matplotlib`, omitting `plt.axis('off')` will result in axes and tick marks appearing around the image, which is usually undesirable for word cloud visualizations.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade `wordcloud` to the latest version (1.9.6 or newer) to ensure compatibility with recent `Pillow` versions. If unable to upgrade `wordcloud`, consider pinning `Pillow` to a version older than 10.","message":"Older versions of `wordcloud` (e.g., 1.8.2.2) generated `DeprecationWarning` messages related to `Pillow`'s `textsize` function being deprecated and removed in `Pillow` 10 (July 2023).","severity":"deprecated","affected_versions":"wordcloud < 1.9.x with Pillow 10+"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}