TL;DR
-
Apple Clang
だとうまくいかないのでGCC
使う-
GCC
のインストールには時間がかかるけど仕方ない(数時間)
-
-
pipenv install
に以下オプションをつけてソースからビルドするようにする- PIP_NO_CACHE_DIR=off
- PIP_NO_BINARY="lightgbm"
環境
- Mac: Mojave (version 10.14.5)
- Python: 3.6.8
- pipenv: 2018.11.26
インストール方法
事前に入れてね
brew install cmake
brew install gcc # 現在、最新のgcc-9がインストールされる
lightgbm入れる
$ pipenv shell # go inside the pipenv virtual shell
(shell) $ export CXX=g++-9 CC=gcc-9 # Use gcc-9 as a compiler to build lightgbm, depending on your gcc version installed
(shell) $ PIP_NO_CACHE_DIR=off PIP_NO_BINARY="lightgbm" pipenv install lightgbm # Build from source
# もしくは
(shell) $ PIP_NO_CACHE_DIR=off PIP_NO_BINARY="lightgbm" pipenv install "lightgbm==2.1.2" # Build from source
packages
の項目に lightgbm
が追加されている
Pipfile
[[source]]
name = "internal pypi"
url = "https://packages.m3internal.com/repository/pypi-all/simple"
verify_ssl = true
[packages]
lightgbm = "2.1.2"
[requires]
python_version = "3.6"
備考
pipenvだと --install-option
が使えない。。。
参照: Support per-requirements overrides (--install-option and --global-option flags