LoginSignup
1
3

More than 5 years have passed since last update.

OSXにXGBoostをインストールする方法

Posted at

 概要

公式チュートリアルやその他のナレッジ記事を見てpip install xgboostを試しても中々インストールに成功しなかったがこちらの記事の通りに実行するとうまく行ったので、Qiitaに載せておきます。

実行環境

OS Python
High Sierra 10.13.2 3.6.4

インストール手順

  1. In your terminal, install homebrew if you haven’t already.
terminal.
 /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

If you encounter errors in this step, you should refer to this website “https://computers.tutsplus.com/tutorials/homebrew-demystified-os-xs-ultimate-package-manager--mac-44884”

  1. Also in the terminal, you should
terminal.
brew install gcc — without-multilib`

the without multilib should help with multi-threading errors that we may encounter later. This may take some time, but if this doesn’t work try

terminal.
sudo apt-get install gcc
sudo apt-get install g++
  1. cd into wherever you want your directory to be, I simply put mine at my root directory, but make sure that this is not within another directory! (we don’t need any pregnant repos)

  2. Clone the repository wherever you want your directory to be using this line

terminal.
git clone — recursive https://github.com/dmlc/xgboost
  1. cd into your new directory called xgboost
terminal.
cd xgboost
  1. Open the make/config.mk. If you have your computer formatted correctly, simply typing “open make/config.mk” may work.
  2. If not you can use the GUI to open it in your favorite text editor, or another command. Uncomment these two lines of code : “export CC = gcc
    export CXX = g++”. Depending on which version of gcc you installed, you may need to change them to “export CC = gcc-6
    export CXX = g++-6”. Make sure you save this and then move on to the next step.

  3. cd into xgboost (if you’re not already there), and then “cp make/config.mk .
    make -j4

  4. Final step : “cd python-package; sudo python setup.py install”

1
3
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
1
3