Install LightGBM in an OS X virtualenv environment

Introduction

LightGBM was used in Kaggle's this article. The page below also mentions that LightGBM is often talked about in Kaggle.

This page describes the flow when you install lightGBM in your OSX virtualenv environment.

flow

Please refer to the installation guide below.

I did the following under the environment I want to install.

$ 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 

At the time of cmake .., the following error may occur.

$ cmake .. 
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:8 (PROJECT):
  The CMAKE_C_COMPILER:

    gcc-7

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:8 (PROJECT):
  The CMAKE_CXX_COMPILER:

    g++-7

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

In my case, this seems to be due to the low version of gcc, and I solved it by upgrading.

$ brew upgrade gcc

Next, refer to the following to enable import.

Install the dependent libraries first.

$ pip install setuptools numpy scipy scikit-learn -U

Go to / LightGBM / python-package / and do the following and you're done.

$ python setup.py install

I was able to import successfully.

import lightgbm as lgb

in conclusion

Thank you very much.

Recommended Posts

Install LightGBM in an OS X virtualenv environment
Install the package in an offline environment
Install the python package in an offline environment
Building an environment for "Tello_Video" on Mac OS X
Create an environment with virtualenv
Pip install in proxy environment
Install Sphinx on Mac OS X
Install scrapy in python anaconda environment
install tensorflow in anaconda + python3.5 environment
Install mitmproxy on Mac OS X
Install pgmagick on Mac OS X 10.9
Mac OS X Mavericks 10.9.5 Development environment construction
Use tensorflow in an environment without root
Install matplotlib on OS X El Capitan
Install virtualenv
Build an environment with pyenv, pyenv-virtualenv, jupyter on OS X El Capitan
I tried putting virtualenv in Cygwin environment
GeoDjango + SQLite environment construction on OS X
Mac OS X Yosemite 10.10 Development environment construction
Mac OS X development environment construction memo
Install rJava on Linux in R3.6 environment.
Creating a virtual environment in an Anaconda environment
Install CaboCha in a non-Anaconda environment (Win)
[mac] Install R in pyenv + Jupyter-Lab environment
Create a Python development environment in 10 minutes (Mac OS X + Visual Studio Code)
Run Qiita API v2 Python wrapper in Python3 environment (Mac OS X 10.11 (El Capitan))
OS X GPU is now supported in Tensorflow
Building an environment that uses Python in Eclipse
Use the latest pip in a virtualenv environment
Install python package in personal environment on Ubuntu
About CI / CD in Chalice x Circle CI environment
Install Python 3.5.1 + numpy + scipy + α in Windows environment
Install gensim in conda environment (and also install mecab)
Work in a virtual environment with Python virtualenv.
Mac OS X Mountain Lion 10.8.5 Development environment construction
Install shogun with python modular (OS X Yosemite)
Matplotlib etc. cannot be imported in VirtualEnv environment
I tried to build an environment for machine learning with Python (Mac OS X)
Build an interactive environment for machine learning in Python
Create an Anaconda virtual environment in your project folder
Procedure to install TensorFlow in fish shell environment (Anaconda 4.0.0)
Build a Python development environment on Mac OS X
mac OS X 10.15.x pyenv Python If you can't install
Run pandas-highcharts display_charts in an environment other than jupyter
Create a Python development environment on OS X Lion
How to install poetry (error handling) in zsh environment
When I tried to install PIL and matplotlib in a virtualenv environment, I was addicted to it.