Lightgbm OSError, Library not loaded

I had the same exact problem on M1 MAC. I have tried to import it through Jupiter notebook. This command solved the problem:

conda install lightgbm

All the above answers didn't work for me. On Mac, if I installed the libomp using brew fixed the problem: Refer: link

brew install libomp

I find a similar problem here LightGBM
The answer and comment may help you.

Build LightGBM in Mac:

brew install cmake  
brew install gcc --without-multilib  
git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM  
mkdir build ; cd build  
cmake ..   
make -j  

Then install:

cd ../python-packages  
sudo python setup.py install --precompile

As stated by @ecodan, you might need to force Mac to use GCC and G++ instead of the default compiler. So instead of building with cmake .., try:

cmake -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/6.1.0/bin/gcc-6 -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/6.1.0/bin/g++-6 ..

ajusting the versions to match yours.