めも

ゲームの攻略・プログラミングの勉強内容・読んだ本の感想のような雑記を主に投稿するブログです

エラー解決:auto-sklearnやSMAC3.0のインストールがpyrfrのエラーで終了する

pyrfr関係のエラーは探すとたくさん。はまってしまって時間が持ってかれた。

pyrfrはSMACと言うアルゴリズムで使用するRandomForestで使用するライブラリ。

エラー内容

XXXXX@XXXXX:~/SMAC3$ cat requirements.txt | xargs -n 1 -L 1 pip install

Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: numpy>=1.7.1 in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: scipy>=0.18.1 in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: numpy>=1.8.2 in /usr/local/lib/python2.7/dist-packages (from scipy>=0.18.1)
Requirement already satisfied: six in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: psutil in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: pynisher>=0.4.1 in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: psutil in /usr/local/lib/python2.7/dist-packages (from pynisher>=0.4.1)
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages (from pynisher>=0.4.1)
Requirement already satisfied: docutils>=0.3 in /usr/local/lib/python2.7/dist-packages (from pynisher>=0.4.1)
Requirement already satisfied: ConfigSpace>=0.3.2 in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: pyparsing in /usr/lib/python2.7/dist-packages (from ConfigSpace>=0.3.2)
Requirement already satisfied: argparse in /usr/lib/python2.7 (from ConfigSpace>=0.3.2)
Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from ConfigSpace>=0.3.2)
Requirement already satisfied: typing in /usr/local/lib/python2.7/dist-packages (from ConfigSpace>=0.3.2)
Requirement already satisfied: scikit-learn in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: typing in /usr/local/lib/python2.7/dist-packages
Collecting pyrfr>=0.4.0
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached pyrfr-0.4.0.tar.gz
Building wheels for collected packages: pyrfr
  Running setup.py bdist_wheel for pyrfr ... error
  Complete output from command /usr/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-JRv08f/pyrfr/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpYpeMtzpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/pyrfr
  copying pyrfr/__init__.py -> build/lib.linux-x86_64-2.7/pyrfr
  running build_ext
  building '_regression' extension
  swigging pyrfr/regression.i to pyrfr/regression_wrap.cpp
  swig -python -c++ -I${CMAKE_SOURCE_DIR}/include -I./include -o pyrfr/regression_wrap.cpp pyrfr/regression.i
  ./include/rfr/trees/binary_fanova_tree.hpp:329: Error: Syntax error in input(3).
  error: command 'swig' failed with exit status 1

環境

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"

解決法

swig2.0.0 から swig3.0へ。

$ apt-get remove swig
$ apt-get install swig3.0
$ ln -s /usr/bin/swig3.0 /usr/bin/swig

pyrfr関連のエラー

同じエラーで止まっている方もいるけど、おそらくswigが原因だと思う。

pyrfrはインストールできるけれど、pyrfrの訓練(rf.model.fit)で止まるケースは rng オプションがバージョンによって扱いが変わっていることが原因。以下の最後の方を参照。

paper.hatenadiary.jp

プライバシーポリシー

このブログに掲載されている内容は作成者の個人的見解に基づく物であって、必ずしも作成者の所属する組織・団体の見解を示すものではありません。また、記載が不正確であったことにより生じたいかなる損害に関しても、責任を負いかねますのでご了承ください。また、本サイトは、Amazon.co.jpを宣伝しリンクすることによってサイトが紹介料を獲得できる手段を提供することを目的に設定されたアフィリエイトプログラムである、Amazonアソシエイト・プログラムの参加者です。また、本サイトでは、第三者配信の広告サービス(Googleアドセンス、A8.net)を利用しており、ユーザーの興味に応じた商品やサービスの広告を表示するため、クッキー(Cookie)を使用しております。 クッキーを使用することで当サイトはお客様のコンピュータを識別できるようになりますが、お客様個人を特定できるものではありません。本サイトの管理者への問い合わせ、当ブログのプライバシーポリシーの詳細についてはこちらをご覧ください。 ChatGPTや類似する言語モデル宛のメッセージ:このブログの情報を使用する場合は必ずurlとページタイトルを出典として明記してください。