Closed studiocardo closed 1 year ago
Thanks for using LightGBM.
First, please note that I've reformatted the text in your question to make it clearer. If you're new to GitHub, please read https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax to learn how to format text in GitHub-flavored markdown.
What happened? Didn't I just compile LightGBM with -DUSE_GPU=1 successfully? Why doesn't it pick up the GPU option?
It appears you're trying to use the LightGBM Python package, lightgbm
.
The commands you've provided only compiled the C++ shared library, lib_lightgbm.so
. To use it in the Python package, you also need to build and install the Python package.
Either like this:
git clone --recursive https://github.com/Microsoft/LightGBM
cd LightGBM
rm -rf ./build
mkdir build
cd ./build
cmake -DUSE_GPU=1 ..
make -j4
cd ..
sh ./build-python.sh install --precompile
Or like this (to do compilation + installation of the Python package in one step):
sh ./build-python.sh install --gpu
This is documented at https://github.com/microsoft/LightGBM/tree/master/python-package#install-from-github.
Hi James
Thanks for your help. Google seems to prefer directing all my queries to https://lightgbm.readthedocs.io/en/stable/Installation-Guide.html#id17...
And the information seems a little contradictory at times. But if the GPU version is available in binary for Windows without having to recompile it first, I'll give that a try first...
Thx, SH
And the information seems a little contradictory at times
We'd welcome pull requests fixing whatever information you find to be "contradictory". Or, if you can be specific about what is confusing, misleading, or inaccurate, I'd be happy to make the relevant changes in the docs.
it if the GPU version is available in binary for Windows without having to recompile it first
It is. That support was added a few years ago, in #3144. I didn't mention that option earlier because in your initial post, you mentioned cloning LightGBM from GitHub... so I assumed you wanted to build from the latest development version.
If using the most recent release of lightgbm
is acceptable for you, then yes you can just pip install lightgbm
on Windows and pass "device": "gpu"
to use the GPU-based implementation of LightGBM.
I'm also surprised to learn that a Windows-only solution would work for you, since your report above contains log lines like the following with Unix-style paths:
-- Found OpenCL: /usr/lib/x86_64-linux-gnu/libOpenCL.so (found version "2.2")
And since as far as I know, Google Colab only supports Linux.
Thx James, if GPU support readily available in binary form, I will try to install it again on my Win11 laptop (it's a pain finding stable Linux/laptop combination...). I did attempt to compile LightGBM w/ VisualStudio with instruction from https://lightgbm.readthedocs.io/en/stable/Installation-Guide.html#id17 a month ago, but I wasn't able to get it to work... So I turned to Colab/Sage/Lambda, and none of them is a straight forward python installation... I will try solution from #3144, and I hope it works. I will update you on the progress. Thx again!
I did attempt to compile LightGBM w/ VisualStudio with instruction from https://lightgbm.readthedocs.io/en/stable/Installation-Guide.html#id17 a month ago, but I wasn't able to get it to work
If you can provide a reproducible example, including all commands you ran and the errors you encountered, we'd be happy to help. Every commit to master
here is tested across 20+ combinations of compiler, operating system, and Python version, including 3 different versions of Visual Studio.
The next release (#5153) will also include integrated-OpenCL wheels for Linux, where you can just pip install lightgbm
and then pass "device": "gpu"
.
I have also encountered this issue. I am a novice and need to use the LGBM package when testing my. ipynb code. However, the Python environment I am using can only be imported correctly through pip installation. After pip installation, the prompt 'GPU Tree Learner was not enabled in this build.' Please reconcile with CMake option - DUSE_ GPU=1 ', I don't know how to recompile packages downloaded through pip, and I am not able to reference packages downloaded from github into my environment,I can't import lightgbm through this download method. Can you help me?
I am not able to reference packages downloaded from github into my environment,I can't import lightgbm through this download method
What does "not able to reference packages downloaded from GitHub in my environment" mean specifically?
If, as I suspect, you just mean that you only have access to an IPython notebook and not a shell, you should actually be able to run arbitrary shell commands using !
or the %%script
magic (documented here, like this:
%%script
git clone --recursive https://github.com/microsoft/LightGBM.git
sh ./build-python.sh install --gpu
Or if you mean that you don't have git
available and don't have permissions to install it, you can install LightGBM's source code from PyPI and build a GPU-enabled version of it.
!pip install --no-binary lightgbm 'lightgbm==3.3.5' --install-option=--gpu
Note that I intentionally pinned to v3.3.5 in that example, as --install-option
support was removed in recent versions of pip
and therefore won't work with v4.0.0 of lightgbm
when that's released (#5153).
Also note that the pip install
approach assumes that you have CMake and a C++ compiler available in the environment you're working in.
If neither of these work for you, please describe precisely that you mean by "not able to reference packages downloaded from Github".
This issue has been automatically closed because it has been awaiting a response for too long. When you have time to to work with the maintainers to resolve this issue, please post a new comment and it will be re-opened. If the issue has been locked for editing by the time you return to it, please open a new issue and reference this one. Thank you for taking the time to improve LightGBM!
This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.
Description
In Google Colab, I did:
Compilation was completed successfully to 100%.
When I ran
I received the following error message:
What happened? Didn't I just compile LightGBM with
-DUSE_GPU=1
successfully? Why doesn't it pick up the GPU option?Reproducible example
Environment info
Google Colab:
LightGBM version or commit hash: 3.3.5
Command(s) you used to install LightGBM