amueller / word_cloud

A little word cloud generator in Python
https://amueller.github.io/word_cloud
MIT License
10.1k stars 2.31k forks source link

ValueError: Only supported for TrueType fonts on Databricks #742

Open rlleshi opened 10 months ago

rlleshi commented 10 months ago

Description

I'm trying to use wordcloud in databricks but am getting this error: ValueError: Only supported for TrueType fonts.

I also tried to upload a font to dbfs and then supply it to the WordCloud constructor accordingly but it still fails with the same error.

Steps/Code to Reproduce

from wordcloud import WordCloud
text = 'trim kulzer wahrsch spotify kenia grace apache zwei null sieben roller spotify madonna lana del rey '
wordcloud = WordCloud(
    scale=10,
    background_color="white", 
    random_state=1,
    colormap="inferno",
).generate(text)

plt.figure(figsize=(10, 5))
plt.imshow(wordcloud, interpolation="bilinear")
plt.axis("off")
plt.show()

Expected Results

Visualized wordcloud.

Actual Results

Error thrown: ValueError: Only supported for TrueType fonts

Versions

Linux-5.15.0-1042-azure-x86_64-with-glibc2.31
Python 3.9.5 (default, Nov 23 2021, 15:27:38) 
[GCC 9.3.0]
NumPy 1.24.4
matplotlib 3.5.1
wordcoud 1.9.2