Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LightGBM Image Not Found after Mac install

I installed the lightgbm package with pip (version 10.0.1) to my Python lib (version 3.6.3) on macOS Sierra (version 10.12.6), along with the dependencies found in the documentation, including open-mpi, cmake and gcc.

However, I keep receiving the following exception when I try to import the package using Jupyter notebook (version 5.0.0):

OSError: dlopen(/Users/admin/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/admin/anaconda3/lib/python3.6/site-packages/lightgbm/lib_lightgbm.so 
Reason: image not found

This question was also asked here, but I'm not sure if there was a solution.



Update: I had a newer version of GCC (version 8) in the filepath, hence the reason the GCC library was not loaded from path: /usr/local/opt/gcc/lib/gcc/7.

It didn't work when I updated the installation script to reflect the latest version (8.1.0) of gcc on my brew install download, as follows:

brew install open-mpi
brew install cmake
brew install gcc

git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
export CXX=g++-8 CC=gcc-8  # replace 7 with version of gcc installed on your machine
mkdir build ; cd build
cmake -DUSE_MPI=ON ..
make -j4

I had to download version 7 and manually insert it into the local gcc folder.


Solution: I also followed the solution for a similar problem found here.

like image 805
Louis Avatar asked Jun 16 '18 15:06

Louis


2 Answers

LightGBM can be installed directly via Homebrew:

brew install lightgbm

See the Installation Guide for more details.

like image 187
Andi R Avatar answered Nov 10 '22 19:11

Andi R


Installing with conda rather than pip (conda install lightgbm) solved this issue for me.

like image 24
Garrett Johnson Avatar answered Nov 10 '22 19:11

Garrett Johnson