LoginSignup
6
2

More than 5 years have passed since last update.

XGBoostをUbuntuにもAnaconda環境にも入れられなかった話

Posted at

はじめに

XGBoostのインストールで詰まる人が多いみたいですが、私もそのうちの一人で、悲しみを背負っていました。
「この方法ならできるよ」というベストプラクティスでもなぜかエラーが起こる悲しい世界。
私は以下の方法でインストールが完了しました。なぜできたのかは謎。

実行環境

  • n1-standard-1(vCPU x 1、メモリ 3.75 GB)
  • Ubuntu 16.04.3
  • Anaconda 3.4.0

成功した手順

Ubuntu環境にインストールする

install-xgb-ubuntu
$ sudo apt-get install gcc
$ git clone --recursive https://github.com/dmlc/xgboost
$ cd xgboost; make -j4
$ sudo apt-get install python-setuptools
$ cd python-package
$ sudo python setup.py install

# numpy errorが出た場合は以下で代用
# $ sudo -s
# $ python setup.py install

 Anacondaの仮想環境にインストールする

調べてみるとPython2の環境なら$ pip install xgboostを実行するだけでインストールできるよ(ニッコリという投稿が多かったのですが、私はエラーが発生しました。

上記のUbuntu環境にインストールする$ sudo apt-get install python-setuptoolsまで実行してから下記の手順で進めていけばエラーなくインストールできました。

install-xgb-condaenv
$ cd xgboost  
$ ./build.sh
$ source activate py27 #py27は仮想環境の名前
$ pip install -e python-package

参照

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2