Install LightGBM on macOS High Sierra

Ting-Hao Chen
Programming Notes
Published in
1 min readSep 21, 2018

If you fail on installing LightGBM, you might wanna take a look at this post.

I followed the official guide and tried to install LightGBM on macOS High Sierra, but I failed.

According to the official guide, you will have to do the following steps:

(bash) >>> brew install cmake
(bash) >>> brew install libomp
(bash) >>> git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
(bash) >>> mkdir build ; cd build
(bash) >>> cmake ..
(bash) >>> make -j4

I got the errors like this:

OSError: dlopen(/Users/xxx/anaconda3/lib/python3.6/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/gcc/lib/gcc/7/libgomp.1.dylib
Referenced from: /Users/xxx/anaconda3/lib/python3.6/site-packages/lightgbm/lib_lightgbm.so
Reason: image not found

The solution I found on the internet is here. Instead of doing the steps mentioned above, try the steps below.

(bash) >>> brew update
(bash) >>> brew upgrade
(bash) >>> pip uninstall lightgbm
(bash) >>> git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
(bash) >>> export CXX=g++-8 CC=gcc-8
(bash) >>> mkdir build ; cd build
(bash) >>> cmake ..
(bash) >>> make -j4
(bash) >>> pip install --no-binary :all: lightgbm

If you didn’t get any errors during installing, then you have succeeded. Now, let’s test!

(bash) >>> python
(python) >>> import fbprophet

--

--