Error with Python import LightGBM

Viewed 2543

I have installed lightGBM as described here on Linux:

https://github.com/Microsoft/LightGBM/wiki/Installation-Guide#linux-2

I am able to successfully run the GPU training (and CPU) using the CLI: https://github.com/Microsoft/LightGBM/blob/master/docs/GPU-Tutorial.md#run-your-first-learning-task-on-gpu

However, when i try to import the python package (python 3.6) I receive the following error:

OSError: /home/anaconda3/lib/python3.6/site-packages/lightgbm-0.2-py3.6.egg/lightgbm/lib_lightgbm.so: symbol clCreateCommandQueueWithProperties, version OPENCL_2.0 not defined in file libOpenCL.so.1 with link time reference

I am pretty new to understanding linking and other things that may be the problem. Anyone able to provide some easy to follow suggestions?

2 Answers

LightGBM now comes with a python API.

import numpy as np
from lightgbm import LGBMClassifier
from sklearn.datasets import make_moons


model = LGBMClassifier(boosting_type='goss', num_leaves=31, max_depth=- 1, learning_rate=0.1, n_estimators=300, device = "gpu")

train, label = make_moons(n_samples=300000, shuffle=True, noise=0.3, random_state=None)

model.fit(train, label)

If you managed to build it for the GPU, you are probably a couple of steps away from setting up the python interface.

Assuming the built was successful and the repertory looks like this:

~/Codes/LightGBM$ tree -d -L 1
.
├── build
├── compute
├── docker
├── docs
├── examples
├── helpers
├── include
├── pmml
├── python-package
├── R-package
├── src
├── swig
├── tests
└── windows

Simply use the following commands to set up the python API.

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

Source detailed guide to install LightGBM with GPU support

Related