Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Studio instance not found when building python package gpu version when using VS2022 and how I solved it #4906

Closed
124san opened this issue Dec 23, 2021 · 5 comments

Comments

@124san
Copy link

124san commented Dec 23, 2021

I tried to install python package gpu version after downloading and installing all the prerequisites, including Visual Studio, Boost and OpenCL. However, it resulted in "Exception Please install Visual Studio or MS Build and all required dependencies first" (screenshot doesnt have any install option because it was for reproducing the error, which the same with install options included):
Screenshot 2021-12-23 152149
Checking the logs gives me something like this:
image

The first thing I did after the error is to install 2019 build tools within Visual Studio 2022. However, it still gave me the same error after installing. I had no luck with 2017 build tools either.

After a decent amount of googling, I found this post on stackoverflow. The accepted answer suggested installing the entire "Visual Studio Build Tools 2017" which include MSBuild. After downloading and installing 2019 build tools, the build command for gpu version finally succeeded. Here is the command I used, with 1.78.0 boost: pip install lightgbm --install-option=--gpu --install-option="--opencl-include-dir=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.5/include" --install-option="--opencl-library=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.5/lib/x64/OpenCL.lib" --install-option="--boost-root=C:/local/boost_1_78_0" --install-option="--boost-librarydir=C:/local/boost_1_78_0/lib64-msvc-14.2".

TLDR: Python LightGBM gpu version build process does not pick up Visual Studio 2022 version, even if it has older version of build tools inside. You have to install older Visual Studio or Build Tools seperately.

@StrikerRUS
Copy link
Collaborator

@124san Thanks for reporting this issue!

Support for Visual Studio 2022 was added a few days ago (#4889) and next release of LightGBM will respect it correctly. For now you can install nightly builds: https://lightgbm.readthedocs.io/en/latest/Installation-Guide.html#nightly-builds.

Just a note: I'm glad that GPU version finely worked with Boost 1.78 and CUDA 11.5 (we are not testing this combination of dependencies on our CI)!

@jameslamb
Copy link
Collaborator

One other note... @124san in the future, if possible, please post error messages and logs as text instead of screenshots. That makes it possible for others facing similar issues to find these discussions from search engines.

@124san
Copy link
Author

124san commented Dec 24, 2021 via email

@124san
Copy link
Author

124san commented Dec 24, 2021

@124san Thanks for reporting this issue!

Support for Visual Studio 2022 was added a few days ago (#4889) and next release of LightGBM will respect it correctly. For now you can install nightly builds: https://lightgbm.readthedocs.io/en/latest/Installation-Guide.html#nightly-builds.

Just a note: I'm glad that GPU version finely worked with Boost 1.78 and CUDA 11.5 (we are not testing this combination of dependencies on our CI)!

I'm glad that it works with newest Boost and CUDA! Also, thanks for letting me know about the support for VS2022.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants