Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

During installation of lightgbm it says that you should install cmake first, while I have installed it

I want to install the GPU version of lightgbm on Ubuntu, based on the following command:

pip install lightgbm --install-option=--gpu

During installation, an error is occurred saying "Please install CMake first". After installing CMake, I get the same error again. To be sure that CMake is installed, I run the following command and get the correct version of the installed CMake:

/opt/cmake/bin/cmake -version

What is the possible reason of this error?

like image 497
Hossein Avatar asked Nov 03 '17 14:11

Hossein


1 Answers

I got exactly this error, on Ubuntu 16.04 with CUDA installed and cmake version 3.5.1. In my case, despite the "Please install CMake" error, the issue was:

  • The necessary boost libraries were not installed, and
  • cmake was not able to find OpenCL.

I was able to install LightGBM for Python by doing the following:

# Install boost libraries.
sudo apt-get install libboost-all-dev
# Get LightGBM source.
git clone --recursive https://github.com/Microsoft/LightGBM.git
cd LightGBM/python-package/
# cmake specifying locations of OpenCL files.
sudo cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda-8.0/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda-8.0/include/ ..
# Compile.
sudo make
# Install for Python, using what we just compiled.
python setup.py install --precompile

After that I was able to run Python and import lightgbm successfully.

Didn't help?

"Please install CMake" can mask other errors. To see more detail about what is going wrong, in LightGBM/python-package/setup.py, in the function silent_call, change the line

subprocess.check_output(cmd, stderr=shut_up)

to

subprocess.check_output(cmd) 

and run

python setup.py install --gpu
like image 177
andycraig Avatar answered Sep 20 '22 16:09

andycraig