A3M4 / YouTube-Report

:bar_chart: Generate a personal YouTube report from your Google Takeout data
MIT License
642 stars 62 forks source link

wordcloud problems (python3.7) #2

Open Flewrider opened 4 years ago

Flewrider commented 4 years ago

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 commented 4 years ago

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

RiedleroD commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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