Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wordcloud problems (python3.7) #2

Open
Flewrider opened this issue Dec 14, 2019 · 8 comments
Open

wordcloud problems (python3.7) #2

Flewrider opened this issue Dec 14, 2019 · 8 comments

Comments

@Flewrider
Copy link

Flewrider commented Dec 14, 2019

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
@arpreq
Copy link

arpreq commented Dec 14, 2019

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

@RiedleroD
Copy link
Contributor

Looks more like a problem related to the differences between linux and windows, but I'll have to investigate further to confirm that assumption.

@rogeliomartinez0505
Copy link

Traceback (most recent call last):
File "report.py", line 234, in
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
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in
import apt
File "/usr/lib/python3/dist-packages/apt/init.py", line 23, in
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
File "report.py", line 234, in
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

@selplacei
Copy link

Getting the same error, except without the 'apt_pkg' part. STDOUT and STDERR: https://paste.rs/MGB

Running on Arch Linux with Python 3.8.

@RiedleroD
Copy link
Contributor

Can you test if you get the same error when using my fork? Please open a separate issue there if there's still something wrong. Unlike other people, I'll actually fix the problem if there is one.

@selplacei
Copy link

Can you test if you get the same error when using my fork? Please open a separate issue there if there's still something wrong. Unlike other people, I'll actually fix the problem if there is one.

Your issues are closed, but I tried it out anyway. The bug is still exactly the same.

@RiedleroD
Copy link
Contributor

I don't know why the issues were closed, they should be there now. I also hopefully fixed the OSError that gets raised in your case. Can you please confirm that?

@selplacei
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants