how to install lightgbm on macOS

While installing lightgbm on macbook, i.e., try to do this “python3 -m pip install lightgbm”,
I encounted the two following errors one at a time:
(1) subprocess.CalledProcessError: Command ‘[‘make’,’_lightgbm’ … ] some error related to cmake
(2) fatal error: ‘omp.h’ file not found

Solutions to install lightgbm on macOS are:

first solution, simply do

brew install lightgbm

second solution, using pip install

  1. Install CMake (3.16 or higher):
    brew install cmake
  2. Install OpenMP:
    brew install libomp
  3. insall lightgbm using pip
    python3 -m pip install lightgbm

Author: robot learner
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source robot learner !