0

MacにWordCloudをインストールしようとしたのですが、インストールがうまくいきませんでした。

$ git clone https://github.com/amueller/word_cloud
$ cd word_cloud
$ python setup.py install

として、installを行ったところ、以下のような警告・エラーが出てきました。

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_requires'
  warnings.warn(msg)
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg) 
~中略~
wordcloud/query_integral_image.c:2060:16: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
  __pyx_v_x = (__pyx_v_integral_image.shape[0]);
            ~  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wordcloud/query_integral_image.c:2069:16: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
  __pyx_v_y = (__pyx_v_integral_image.shape[1]);
            ~  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
~中略~
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
warning: no files found matching '*.c'
warning: no files found matching '*.h'
warning: no files found matching '*.sh'
no previously-included directories found matching 'docs/_static'
warning: no previously-included files found matching '.appveyor.yml'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.codecov.yml'
warning: no previously-included files found matching '.editorconfig'
warning: no previously-included files found matching '.landscape.yaml'
warning: no previously-included files found matching '.travis'
warning: no previously-included files found matching '.travis/*'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files matching '.git*' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution


The headers or library files could not be found for jpeg,
a required dependency when compiling Pillow from source.

Please see the install instructions at:
   https://pillow.readthedocs.io/en/latest/installation.html

調べてもよくわからなかったので、どなたか解決法をご存知でしたらお教えいただけると幸いです。

1 件の回答 1

1

WordCloudをインストールするためには、画像処理ライブラリPillowが必要で、Pillowには外部ライブラリーとしてlibjpegが必要になります。それがエラーの内容です。

The headers or library files could not be found for jpeg, a required
dependency when compiling Pillow from source.

・Pillow ドキュメント Building From Source

対応としては、libjpegをインストールすることですが、Macの場合は、パッケージマネージャHomebrewを導入してライブラリを管理するのが一般的です。その場合は、次のコマンドでインストールできます。

brew install libjpeg

なお、参考までにいうと、OS付属のpython2.7を使うよりも、Homebrewだと簡単にbrew install python3でPython3がインストールできるので、python3, pip3というコマンドでPython3の方を使った方がやりやすいと思います。

この質問に回答するには、ログインする必要があります。

求めていた回答ではありませんか? のタグが付いた他の質問を参照する。