-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[WIP][docs] update Python-package installation guide #6767
base: master
Are you sure you want to change the base?
Conversation
@@ -34,10 +34,14 @@ | |||
# OpenCL include directory. | |||
# --opencl-library=FILEPATH | |||
# Path to OpenCL library. | |||
# --sanitizers=LIST_OF_SANITIZERS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add missed options from https://github.com/microsoft/LightGBM/blob/master/docs/Installation-Guide.rst.
# --user | ||
# Install into user-specific instead of global site-packages directory. | ||
# Only used with 'install' command. | ||
|
||
set -e -u | ||
|
||
echo "building lightgbm" | ||
echo "[INFO] building lightgbm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the consistency with
Line 141 in 60b0155
echo "[INFO] Attempting to build 32-bit version of LightGBM, which is only supported on Windows with generator '${CMAKE_GENERATOR}'." |
and to better distinguish between our own logs and scikit-build-core ones.
######### | ||
# flags # | ||
######### | ||
--bit32) | ||
export CMAKE_GENERATOR="Visual Studio 17 2022" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow to use any default Visual Studio version.
elif test -f ../lib_lightgbm.dll; then | ||
echo "[INFO] found pre-compiled lib_lightgbm.dll" | ||
cp ../lib_lightgbm.dll ./lightgbm/lib/lib_lightgbm.dll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be located there after compilation with MinGW: https://github.com/microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#mingw-w64
elif test -f ../windows/x64/Debug_DLL/lib_lightgbm.dll; then | ||
echo "[INFO] found pre-compiled windows/x64/Debug_DLL/lib_lightgbm.dll" | ||
cp ../windows/x64/Debug_DLL/lib_lightgbm.dll ./lightgbm/lib/lib_lightgbm.dll | ||
cp ../windows/x64/Debug_DLL/lib_lightgbm.lib ./lightgbm/lib/lib_lightgbm.lib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be located there after compilation with Debug_DLL
config:
LightGBM/windows/LightGBM.vcxproj
Lines 4 to 6 in 60b0155
<ProjectConfiguration Include="Debug_DLL|x64"> | |
<Configuration>Debug_DLL</Configuration> | |
<Platform>x64</Platform> |
@@ -197,77 +271,76 @@ Install from `conda-forge channel <https://anaconda.org/conda-forge/lightgbm>`_ | |||
|
|||
conda install -c conda-forge lightgbm | |||
|
|||
These are precompiled packages that are fast to install. | |||
Use them instead of ``pip install`` if any of the following are true: | |||
These packages support **CPU**, **GPU** and **CUDA** versions out of the box. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify a little bit.
@@ -197,77 +271,76 @@ Install from `conda-forge channel <https://anaconda.org/conda-forge/lightgbm>`_ | |||
|
|||
conda install -c conda-forge lightgbm | |||
|
|||
These are precompiled packages that are fast to install. | |||
Use them instead of ``pip install`` if any of the following are true: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, what is the official recommended (preferred) method for installing LightGBM? pip or conda?
If conda, then we should change the order of them in the doc.
|
||
Run ``sh ./build-python.sh install --nomp`` to disable **OpenMP** support. All requirements from `Build Threadless Version section <#build-threadless-version>`__ apply for this installation option as well. | ||
|
||
Run ``sh ./build-python.sh install --mpi`` to enable **MPI** support. All requirements from `Build MPI Version section <#build-mpi-version>`__ apply for this installation option as well. | ||
|
||
Run ``sh ./build-python.sh install --mingw``, if you want to use **MinGW-w64** on **Windows** instead of **Visual Studio**. All requirements from `Build with MinGW-w64 on Windows section <#build-with-mingw-w64-on-windows>`__ apply for this installation option as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the same order as in the Install from PyPI -> Build from Sources
section.
|
||
Build With MSBuild |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Building with MSBuild is a part of "build dynamic library from sources by any method you prefer", so there is no need in a separate section for it.
cmake.args = [ | ||
"-D__BUILD_FOR_PYTHON:BOOL=ON" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use define
instead of args
. This allows to use --config-setting=cmake.args=-G'MinGW Makefiles'
from comand line because defines are appended and args are overwriten.
Warning
Setting defines throughcmake.args
inpyproject.toml
is discouraged because this cannot be later altered via command line. Usecmake.define
instead.
https://scikit-build-core.readthedocs.io/en/latest/configuration.html#configuring-cmake-arguments-and-defines
Every installation method and some their combinations were tested with the help of our CI (Appveyor and GitHub Actions). Everything is working except
--sanitizers
flag: package installation is successful but it's import fails:log:
I'm not sure we ever checked even building LightGBM (not
testlightgbm
) with sanitizers.