question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

wordcloud problems (python3.7)

See original GitHub issue

Running the script only works with 3.7 for me and generates the following error after installing all dependencies for the correct version with “python3.7 -m pip install -r requirements.txt”:

Generating Word Cloud.....
Traceback (most recent call last):
  File "report.py", line 234, in <module>
    visual.wordCloud()
  File "report.py", line 83, in wordCloud
    max_words=380,contour_width=2, prefer_horizontal=1).generate(unique_string)
  File "/home/flew/.local/lib/python3.7/site-packages/wordcloud/wordcloud.py", line 619, in generate
    return self.generate_from_text(text)
  File "/home/flew/.local/lib/python3.7/site-packages/wordcloud/wordcloud.py", line 601, in generate_from_text
    self.generate_from_frequencies(words)
  File "/home/flew/.local/lib/python3.7/site-packages/wordcloud/wordcloud.py", line 434, in generate_from_frequencies
    max_font_size=self.height)
  File "/home/flew/.local/lib/python3.7/site-packages/wordcloud/wordcloud.py", line 483, in generate_from_frequencies
    font = ImageFont.truetype(self.font_path, font_size)
  File "/home/flew/.local/lib/python3.7/site-packages/PIL/ImageFont.py", line 640, in truetype
    return freetype(font)
  File "/home/flew/.local/lib/python3.7/site-packages/PIL/ImageFont.py", line 637, in freetype
    return FreeTypeFont(font, size, index, encoding, layout_engine)
  File "/home/flew/.local/lib/python3.7/site-packages/PIL/ImageFont.py", line 186, in __init__
    font, size, index, encoding, layout_engine=layout_engine
OSError: cannot open resource
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "report.py", line 234, in <module>
    visual.wordCloud()
  File "report.py", line 83, in wordCloud
    max_words=380,contour_width=2, prefer_horizontal=1).generate(unique_string)
  File "/home/flew/.local/lib/python3.7/site-packages/wordcloud/wordcloud.py", line 619, in generate
    return self.generate_from_text(text)
  File "/home/flew/.local/lib/python3.7/site-packages/wordcloud/wordcloud.py", line 601, in generate_from_text
    self.generate_from_frequencies(words)
  File "/home/flew/.local/lib/python3.7/site-packages/wordcloud/wordcloud.py", line 434, in generate_from_frequencies
    max_font_size=self.height)
  File "/home/flew/.local/lib/python3.7/site-packages/wordcloud/wordcloud.py", line 483, in generate_from_frequencies
    font = ImageFont.truetype(self.font_path, font_size)
  File "/home/flew/.local/lib/python3.7/site-packages/PIL/ImageFont.py", line 640, in truetype
    return freetype(font)
  File "/home/flew/.local/lib/python3.7/site-packages/PIL/ImageFont.py", line 637, in freetype
    return FreeTypeFont(font, size, index, encoding, layout_engine)
  File "/home/flew/.local/lib/python3.7/site-packages/PIL/ImageFont.py", line 186, in __init__
    font, size, index, encoding, layout_engine=layout_engine
OSError: cannot open resource

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
arpreqcommented, Dec 14, 2019

Enclose multi-line code blocks with 3 backticks to format it, like this: ``` multi line code ```

0reactions
selplaceicommented, Jan 27, 2020

The OSError is fixed, but I got a completely different error. See the fork for the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error installing Worldcloud on MacOS with Python 3.7 #618
Description While trying to install word cloud Mac OS using Python 3.7 I get the following error. Steps/Code to Reproduce run: pip3 install ......
Read more >
How to install wordcloud for python? - Stack Overflow
Wordcloud is not a pure Python project as it has some C code. C code needs to be built for different operating systems...
Read more >
i am installing wordcloud using pip but i am unable to do that i ...
Run this command python -m pip install <filename>. I hope using these steps will resolve your problem and word cloud will get downloaded....
Read more >
Generating Word Cloud in Python | Set 2 - GeeksforGeeks
For generating word cloud in Python, modules needed are – matplotlib, pandas and wordcloud. To install these packages, run the following ...
Read more >
wordcloud - Python Package Health Analysis - Snyk
The python package wordcloud was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found