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.
LightGBM can be installed directly via Homebrew:
brew install lightgbm
See the Installation Guide for more details.
Installing with conda rather than pip (conda install lightgbm
) solved this issue for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With