13

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.

Louis
  • 185
  • 1
  • 2
  • 12

3 Answers3

23

LightGBM can be installed directly via Homebrew:

brew install lightgbm

See the Installation Guide for more details.

Andy R
  • 1,339
  • 10
  • 20
3

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

-1

ligthGBM can be installed using Homebrew. first, we need to install homebrew, See a useful youtube video on "how to install homebrew " https://www.youtube.com/watch?v=N-SDrN4G4lE When homebrew is installed then brew install lightgbm

  • stackoverflow appreciates that you are providing answers but it would be better if you provide the steps here rather than directing to do from a video, you are always free to suggest a video, but it is always better to help answer seeker to provide direct answers – bhucho Nov 14 '20 at 10:40