From 1f6c7731221a58f2541dd155fbd72da0bbcf8a10 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 04:16:13 +0300 Subject: [PATCH 001/112] Update README.rst --- python-package/README.rst | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index face6bba6b74..672070a03351 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -18,26 +18,16 @@ Install from `PyPI `_ pip install lightgbm -Compiled library that is included in the wheel file supports both **GPU** and **CPU** versions out of the box. This feature is experimental and available only for **Windows** and **Linux** currently. To use **GPU** version you only need to install OpenCL Runtime libraries. For NVIDIA and AMD GPU they are included in the ordinary drivers for your graphics card, so no action is required. If you would like your AMD or Intel CPU to act like a GPU (for testing and debugging) you can install `AMD APP SDK `_ on **Windows** and `PoCL `_ on **Linux**. Many modern Linux distributions provide packages for PoCL, look for ``pocl-opencl-icd`` on Debian-based distributions and ``pocl`` on RedHat-based distributions. +Compiled library that is included in the wheel file supports both **GPU** (don't confuse with CUDA version) and **CPU** versions out of the box. This feature is available only for **Windows** and **Linux** currently. To use **GPU** version you only need to install OpenCL Runtime libraries. For NVIDIA and AMD GPU they are included in the ordinary drivers for your graphics card, so no action is required. If you would like your AMD or Intel CPU to act like a GPU (for testing and debugging) you can install `AMD APP SDK `_ on **Windows** and `PoCL `_ on **Linux**. Many modern Linux distributions provide packages for PoCL, look for ``pocl-opencl-icd`` on Debian-based distributions and ``pocl`` on RedHat-based distributions. -For **Windows** users, `VC runtime `_ is needed if **Visual Studio** (2015 or newer) is not installed. +For **Windows** users, `VC runtime `_ is needed if **Visual Studio** is not installed. -In some rare cases, when you hit ``OSError: libgomp.so.1: cannot open shared object file: No such file or directory`` error during importing LightGBM, you need to install OpenMP runtime library separately (use your package manager and search for ``lib[g|i]omp`` for doing this). - -For **macOS** (we provide wheels for 3 newest macOS versions) users: - -- Starting from version 2.2.1, the library file in distribution wheels is built by the **Apple Clang** (Xcode_8.3.3 for versions 2.2.1 - 2.3.1, Xcode_9.4.1 for versions 2.3.2 - 3.3.2 and Xcode_11.7 from version 4.0.0) compiler. This means that you don't need to install the **gcc** compiler anymore. Instead of that you need to install the **OpenMP** library, which is required for running LightGBM on the system with the **Apple Clang** compiler. You can install the **OpenMP** library by the following command: ``brew install libomp``. - -- For version smaller than 2.2.1 and not smaller than 2.1.2, **gcc-8** with **OpenMP** support must be installed first. Refer to `Installation Guide `__ for installation of **gcc-8** with **OpenMP** support. - -- For version smaller than 2.1.2, **gcc-7** with **OpenMP** is required. +For **macOS** users, the **OpenMP** library is needed. You can install it by the following command: ``brew install libomp``. Use LightGBM with Dask ********************** -.. warning:: - - Dask-package is only tested on Linux. +Dask-package is only tested on Linux. To install all dependencies needed to use ``lightgbm.dask``, append ``[dask]``. From dc765b05cf853beea3f25fdfadd55f79b3d31bf2 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 04:47:58 +0300 Subject: [PATCH 002/112] Update README.rst --- python-package/README.rst | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index 672070a03351..d412490868e8 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -24,6 +24,15 @@ For **Windows** users, `VC runtime Date: Fri, 20 Dec 2024 04:53:31 +0300 Subject: [PATCH 003/112] Update pyproject.toml --- python-package/pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python-package/pyproject.toml b/python-package/pyproject.toml index 8fcc85814db5..e92850e354a5 100644 --- a/python-package/pyproject.toml +++ b/python-package/pyproject.toml @@ -44,6 +44,10 @@ dask = [ pandas = [ "pandas>=0.24.0" ] +plotting = [ + "graphviz", + "matplotlib" +] scikit-learn = [ "scikit-learn>=0.24.2" ] From 3e841e0b75b6fb983172fca3972b00e62a5bad25 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 05:04:06 +0300 Subject: [PATCH 004/112] Update README.rst --- python-package/README.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index d412490868e8..acda49c50d68 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -78,13 +78,11 @@ Build from Sources pip install --no-binary lightgbm lightgbm -Also, in some rare cases you may need to install OpenMP runtime library separately (use your package manager and search for ``lib[g|i]omp`` for doing this). - For **macOS** users, you can perform installation either with **Apple Clang** or **gcc**. - In case you prefer **Apple Clang**, you should install **OpenMP** (details for installation can be found in `Installation Guide `__) first. -- In case you prefer **gcc**, you need to install it (details for installation can be found in `Installation Guide `__) and specify compilers by running ``export CXX=g++-7 CC=gcc-7`` (replace "7" with version of **gcc** installed on your machine) first. +- In case you prefer **gcc**, you need to install it (details for installation can be found in `Installation Guide `__) and specify compilers by running ``export CXX=g++-7 CC=gcc-7`` (replace "7" with version of **gcc** installed on your machine) first. For **Windows** users, **Visual Studio** (or `VS Build Tools `_) is needed. From deb2d98084eb4c49a334d6f70bbb9e4cf0ebf384 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 05:23:12 +0300 Subject: [PATCH 005/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index acda49c50d68..e382f00f07d8 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -91,7 +91,7 @@ Build Threadless Version .. code:: sh - pip install lightgbm --config-settings=cmake.define.USE_OPENMP=OFF + pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.USE_OPENMP=OFF lightgbm All requirements, except the **OpenMP** requirement, from `Build from Sources section <#build-from-sources>`__ apply for this installation option as well. From afdc323fa252c7de98eecd096fc643c1f5679fb5 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 05:33:50 +0300 Subject: [PATCH 006/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index e382f00f07d8..db98bd1c898c 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -102,7 +102,7 @@ Build MPI Version .. code:: sh - pip install lightgbm --config-settings=cmake.define.USE_MPI=ON + pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.USE_MPI=ON All requirements from `Build from Sources section <#build-from-sources>`__ apply for this installation option as well. From e8f52a8894697bd2f440bff7607c1046ac2cfcbc Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 05:47:42 +0300 Subject: [PATCH 007/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index db98bd1c898c..6651d7770d0a 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -91,7 +91,7 @@ Build Threadless Version .. code:: sh - pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.USE_OPENMP=OFF lightgbm + pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.USE_OPENMP=OFF All requirements, except the **OpenMP** requirement, from `Build from Sources section <#build-from-sources>`__ apply for this installation option as well. From 1f1d88fc95d49af08bd3292bd4d2558e9cc4607f Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 15:14:23 +0300 Subject: [PATCH 008/112] Update README.rst --- python-package/README.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index 6651d7770d0a..65c83d0dbe56 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -144,6 +144,8 @@ All available options that can be passed via ``cmake.define.{option}``. For more details see `FindBoost `__ and `FindOpenCL `__. +Don't confuse with `CUDA version <#build-cuda-version>`__. To use the GPU version within Python, pass ``{"device": "gpu"}`` respectively in parameters. + Build CUDA Version ~~~~~~~~~~~~~~~~~~ @@ -155,7 +157,7 @@ All requirements from `Build from Sources section <#build-from-sources>`__ apply **CUDA** library is needed: details for installation can be found in `Installation Guide `__. -To use the CUDA version within Python, pass ``{"device": "cuda"}`` respectively in parameters. +Don't confuse with `GPU version <#build-gpu-version>`__. To use the CUDA version within Python, pass ``{"device": "cuda"}`` respectively in parameters. Build with MinGW-w64 on Windows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From b537c7e8ac630488162cf79594af653d725f5773 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 15:18:35 +0300 Subject: [PATCH 009/112] Update README.rst --- python-package/README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-package/README.rst b/python-package/README.rst index 65c83d0dbe56..8477021f60dd 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -119,6 +119,8 @@ Build GPU Version All requirements from `Build from Sources section <#build-from-sources>`__ apply for this installation option as well. +For **macOS** users, the GPU version is not supported. + **Boost** and **OpenCL** are needed: details for installation can be found in `Installation Guide `__. Almost always you also need to pass ``OpenCL_INCLUDE_DIR``, ``OpenCL_LIBRARY`` options for **Linux** and ``BOOST_ROOT``, ``BOOST_LIBRARYDIR`` options for **Windows** to **CMake** via ``pip`` options, like .. code:: sh From fefaded01ad6536392aba51cd1377a8ac440a88e Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 15:33:44 +0300 Subject: [PATCH 010/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index 8477021f60dd..b67bd036bcf7 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -132,7 +132,7 @@ For **macOS** users, the GPU version is not supported. All available options that can be passed via ``cmake.define.{option}``. -- Boost_ROOT +- BOOST_ROOT - Boost_DIR From 449292f2caac2af1505233317298ea953c1c4043 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 15:36:24 +0300 Subject: [PATCH 011/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index b67bd036bcf7..f7bbf39b3d2b 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -115,7 +115,7 @@ Build GPU Version .. code:: sh - pip install lightgbm --config-settings=cmake.define.USE_GPU=ON + pip install --no-binary lightgbm lightgbm --config-settings=cmake.define.USE_GPU=ON All requirements from `Build from Sources section <#build-from-sources>`__ apply for this installation option as well. From dd6e17a3d7d5fd34739d61fdf75ff55f1e6a6f39 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 16:14:40 +0300 Subject: [PATCH 012/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index f7bbf39b3d2b..ef88203009e7 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -125,7 +125,7 @@ For **macOS** users, the GPU version is not supported. .. code:: sh - pip install lightgbm \ + pip install --no-binary lightgbm lightgbm \ --config-settings=cmake.define.USE_GPU=ON \ --config-settings=cmake.define.OpenCL_INCLUDE_DIR="/usr/local/cuda/include/" \ --config-settings=cmake.define.OpenCL_LIBRARY="/usr/local/cuda/lib64/libOpenCL.so" From 9d93ca934c3084a0e78d75a1c8060eec3f2a2e18 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 16:29:30 +0300 Subject: [PATCH 013/112] Update README.rst --- python-package/README.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index ef88203009e7..2005e8608b10 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -153,10 +153,12 @@ Build CUDA Version .. code:: sh - pip install lightgbm --config-settings=cmake.define.USE_CUDA=ON + pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.USE_CUDA=ON All requirements from `Build from Sources section <#build-from-sources>`__ apply for this installation option as well. +For **macOS** and **Windows** users, the CUDA version is not supported. + **CUDA** library is needed: details for installation can be found in `Installation Guide `__. Don't confuse with `GPU version <#build-gpu-version>`__. To use the CUDA version within Python, pass ``{"device": "cuda"}`` respectively in parameters. From 71412709cf7e8397109b37903134b199d0aa2c12 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Fri, 20 Dec 2024 20:21:26 +0300 Subject: [PATCH 014/112] Update README.rst --- python-package/README.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index 2005e8608b10..9e0b3ab89946 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -168,9 +168,7 @@ Build with MinGW-w64 on Windows .. code:: sh - # in sh.exe, git bash, or other Unix-like shell - export CMAKE_GENERATOR='MinGW Makefiles' - pip install lightgbm --config-settings=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND + pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-settings=cmake.define.CMAKE_GENERATOR='MinGW Makefiles' `MinGW-w64 `_ should be installed first. From 4ea935f1afcaac3258372502135944c4b6949678 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 00:12:14 +0300 Subject: [PATCH 015/112] Update README.rst --- python-package/README.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index 9e0b3ab89946..38a471bf9034 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -168,7 +168,9 @@ Build with MinGW-w64 on Windows .. code:: sh - pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-settings=cmake.define.CMAKE_GENERATOR='MinGW Makefiles' + # in sh.exe, git bash, or other Unix-like shell + export CMAKE_GENERATOR='MinGW Makefiles' + pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND `MinGW-w64 `_ should be installed first. From ce0b19e5f9d2064d1d5b100254c7680b0ec3a308 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 00:15:39 +0300 Subject: [PATCH 016/112] Update README.rst --- python-package/README.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index 38a471bf9034..e10b4cc15403 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -168,8 +168,7 @@ Build with MinGW-w64 on Windows .. code:: sh - # in sh.exe, git bash, or other Unix-like shell - export CMAKE_GENERATOR='MinGW Makefiles' + export CMAKE_GENERATOR='MinGW Makefiles' || set CMAKE_GENERATOR='MinGW Makefiles' pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND `MinGW-w64 `_ should be installed first. From eb8d2d3610e2e5c90c09e88b784f51888eec18e5 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 00:21:16 +0300 Subject: [PATCH 017/112] Update README.rst --- python-package/README.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index e10b4cc15403..38a471bf9034 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -168,7 +168,8 @@ Build with MinGW-w64 on Windows .. code:: sh - export CMAKE_GENERATOR='MinGW Makefiles' || set CMAKE_GENERATOR='MinGW Makefiles' + # in sh.exe, git bash, or other Unix-like shell + export CMAKE_GENERATOR='MinGW Makefiles' pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND `MinGW-w64 `_ should be installed first. From c55af10041bc334e7f154338eb62c62893a0af31 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 00:22:49 +0300 Subject: [PATCH 018/112] Update README.rst --- python-package/README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index 38a471bf9034..ccc472ebaddb 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -76,7 +76,7 @@ Build from Sources .. code:: sh - pip install --no-binary lightgbm lightgbm + pip install lightgbm --no-binary lightgbm For **macOS** users, you can perform installation either with **Apple Clang** or **gcc**. @@ -115,7 +115,7 @@ Build GPU Version .. code:: sh - pip install --no-binary lightgbm lightgbm --config-settings=cmake.define.USE_GPU=ON + pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.USE_GPU=ON All requirements from `Build from Sources section <#build-from-sources>`__ apply for this installation option as well. @@ -125,7 +125,7 @@ For **macOS** users, the GPU version is not supported. .. code:: sh - pip install --no-binary lightgbm lightgbm \ + pip install lightgbm --no-binary lightgbm \ --config-settings=cmake.define.USE_GPU=ON \ --config-settings=cmake.define.OpenCL_INCLUDE_DIR="/usr/local/cuda/include/" \ --config-settings=cmake.define.OpenCL_LIBRARY="/usr/local/cuda/lib64/libOpenCL.so" From 9d44d6947fe6609ac3ffa225e0773fcac6159e62 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 01:01:22 +0300 Subject: [PATCH 019/112] Update pyproject.toml --- python-package/pyproject.toml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/python-package/pyproject.toml b/python-package/pyproject.toml index e92850e354a5..b675909e21c0 100644 --- a/python-package/pyproject.toml +++ b/python-package/pyproject.toml @@ -66,15 +66,9 @@ build-backend = "scikit_build_core.build" # based on https://github.com/scikit-build/scikit-build-core#configuration [tool.scikit-build] - -cmake.version = "CMakeLists.txt" ninja.version = ">=1.11" ninja.make-fallback = true -cmake.args = [ - "-D__BUILD_FOR_PYTHON:BOOL=ON" -] build.verbose = false -cmake.build-type = "Release" build.targets = ["_lightgbm"] # stripping binaries should be turned back on once this is fixed: # https://github.com/jameslamb/pydistcheck/issues/235 @@ -86,6 +80,13 @@ experimental = false strict-config = false minimum-version = "build-system.requires" +[tool.scikit-build.cmake] +version = "CMakeLists.txt" +cmake.build-type = "Release" + +[tool.scikit-build.cmake.define] +__BUILD_FOR_PYTHON = true + # end:build-system [tool.mypy] From fb9050004e0ddd546ea4d16cc1cda60135bff000 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 01:02:51 +0300 Subject: [PATCH 020/112] Update README.rst --- python-package/README.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index ccc472ebaddb..1979215bffa3 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -168,9 +168,7 @@ Build with MinGW-w64 on Windows .. code:: sh - # in sh.exe, git bash, or other Unix-like shell - export CMAKE_GENERATOR='MinGW Makefiles' - pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND + pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-settings=cmake.args="-GMinGW Makefiles" `MinGW-w64 `_ should be installed first. From 6790bdd4d4d994a3c608274214e20f2d5b7519c9 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 01:10:23 +0300 Subject: [PATCH 021/112] Update README.rst --- python-package/README.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index 1979215bffa3..32dae98098dd 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -185,8 +185,6 @@ Build 32-bit Version with 32-bit Python export CMAKE_GENERATOR_PLATFORM='Win32' pip install --no-binary lightgbm lightgbm -By default, installation in environment with 32-bit Python is prohibited. However, you can remove this prohibition on your own risk by passing ``bit32`` option. - It is **strongly not recommended** to use this version of LightGBM! Build with Time Costs Output From 8c58b4fa7ef861e722135c8c9a0de24e1f7de1c4 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 01:36:52 +0300 Subject: [PATCH 022/112] Update README.rst --- python-package/README.rst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index 32dae98098dd..27c6a1103c11 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -180,10 +180,7 @@ Build 32-bit Version with 32-bit Python .. code:: sh - # in sh.exe, git bash, or other Unix-like shell - export CMAKE_GENERATOR='Visual Studio 17 2022' - export CMAKE_GENERATOR_PLATFORM='Win32' - pip install --no-binary lightgbm lightgbm + pip install lightgbm --no-binary lightgbm --config-settings=cmake.args="-GVisual Studio 14 2015" --config-settings=cmake.args="-AWin32" It is **strongly not recommended** to use this version of LightGBM! From 6f961d9db29666cdaaa2450f72dbd6b318f28759 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 01:37:37 +0300 Subject: [PATCH 023/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index 27c6a1103c11..a45b787d1b78 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -180,7 +180,7 @@ Build 32-bit Version with 32-bit Python .. code:: sh - pip install lightgbm --no-binary lightgbm --config-settings=cmake.args="-GVisual Studio 14 2015" --config-settings=cmake.args="-AWin32" + pip install lightgbm --no-binary lightgbm --config-settings=cmake.args="-GVisual Studio 17 2022" --config-settings=cmake.args="-AWin32" It is **strongly not recommended** to use this version of LightGBM! From e271a29b77b760abda2b56e44b2aba5299d45b93 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 01:39:12 +0300 Subject: [PATCH 024/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index a45b787d1b78..84f2e8afa8e8 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -189,7 +189,7 @@ Build with Time Costs Output .. code:: sh - pip install lightgbm --config-settings=cmake.define.USE_TIMETAG=ON + pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.USE_TIMETAG=ON Use this option to make LightGBM output time costs for different internal routines, to investigate and benchmark its performance. From b747e4d1cfe92dc9664a3df7810ab5731a43adfb Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 01:45:33 +0300 Subject: [PATCH 025/112] Update pyproject.toml --- python-package/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/pyproject.toml b/python-package/pyproject.toml index b675909e21c0..e4a3c73a7ce5 100644 --- a/python-package/pyproject.toml +++ b/python-package/pyproject.toml @@ -85,7 +85,7 @@ version = "CMakeLists.txt" cmake.build-type = "Release" [tool.scikit-build.cmake.define] -__BUILD_FOR_PYTHON = true +__BUILD_FOR_PYTHON = "ON" # end:build-system From 80a7c202e4d342531b93343bdf03dcfd590338e6 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 01:52:03 +0300 Subject: [PATCH 026/112] Update README.rst --- python-package/README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python-package/README.rst b/python-package/README.rst index 84f2e8afa8e8..d8b2f65ffed6 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -193,6 +193,15 @@ Build with Time Costs Output Use this option to make LightGBM output time costs for different internal routines, to investigate and benchmark its performance. +Build in Debug Mode +~~~~~~~~~~~~~~~~~~~ + +.. code:: sh + + pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.USE_DEBUG=ON + +Use this mode to make LightGBM perform more checks internally and disable all compiler optimizations. + Install from `conda-forge channel `_ ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' From 8f6cb0510ab44a730789610b061850ccc5fe5771 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 02:06:03 +0300 Subject: [PATCH 027/112] Update README.rst --- python-package/README.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/python-package/README.rst b/python-package/README.rst index d8b2f65ffed6..9d0f6e5f3d17 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -202,6 +202,17 @@ Build in Debug Mode Use this mode to make LightGBM perform more checks internally and disable all compiler optimizations. +Build with Sanitizers +~~~~~~~~~~~~~~~~~~~~~ + +.. code:: sh + + pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.USE_SANITIZER=ON --config-settings=cmake.define.ENABLED_SANITIZERS="address;leak;undefined" + +Use this option to build LightGBM with compiler sanitizers. + +For more details see `Installation Guide `__. + Install from `conda-forge channel `_ ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' From 26c921af4989ddd6e8599a5c9840196c0466deca Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 02:07:13 +0300 Subject: [PATCH 028/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index 9d0f6e5f3d17..0d3738bb7ea2 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -211,7 +211,7 @@ Build with Sanitizers Use this option to build LightGBM with compiler sanitizers. -For more details see `Installation Guide `__. +For more details see `Installation Guide `__. Install from `conda-forge channel `_ ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' From e50acb587ebda3dd501e6f9eeacca91eddcda7fc Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 02:22:15 +0300 Subject: [PATCH 029/112] Update README.rst --- python-package/README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python-package/README.rst b/python-package/README.rst index 0d3738bb7ea2..eed6052c11ce 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -184,6 +184,15 @@ Build 32-bit Version with 32-bit Python It is **strongly not recommended** to use this version of LightGBM! +Build without Searching in Homebrew Folders for Dependencies on macOS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code:: sh + + pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.USE_HOMEBREW_FALLBACK=OFF + +Use this option to stop looking into Homebrew standard folders for finding dependencies (e.g. OpenMP) on macOS. + Build with Time Costs Output ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 8eb70050be19b98de23d7f99897da0e3d37114cd Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 02:24:50 +0300 Subject: [PATCH 030/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index eed6052c11ce..8faba6b655de 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -191,7 +191,7 @@ Build without Searching in Homebrew Folders for Dependencies on macOS pip install lightgbm --no-binary lightgbm --config-settings=cmake.define.USE_HOMEBREW_FALLBACK=OFF -Use this option to stop looking into Homebrew standard folders for finding dependencies (e.g. OpenMP) on macOS. +Use this option to stop looking into Homebrew standard folders for finding dependencies (e.g. OpenMP) during the build on macOS. Build with Time Costs Output ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 0dd59835b3d9a789fbd56a0020ea191e53eb8a92 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 02:32:28 +0300 Subject: [PATCH 031/112] Update README.rst --- python-package/README.rst | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/python-package/README.rst b/python-package/README.rst index 8faba6b655de..5a8ac9e65d98 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -24,6 +24,8 @@ For **Windows** users, `VC runtime `_) is needed. +| + Build Threadless Version ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -97,6 +111,8 @@ All requirements, except the **OpenMP** requirement, from `Build from Sources se It is **strongly not recommended** to use this version of LightGBM! +| + Build MPI Version ~~~~~~~~~~~~~~~~~ @@ -110,6 +126,8 @@ For **Windows** users, compilation with **MinGW-w64** is not supported. **MPI** libraries are needed: details for installation can be found in `Installation Guide `__. +| + Build GPU Version ~~~~~~~~~~~~~~~~~ @@ -148,6 +166,8 @@ For more details see `FindBoost `__. To use the GPU version within Python, pass ``{"device": "gpu"}`` respectively in parameters. +| + Build CUDA Version ~~~~~~~~~~~~~~~~~~ @@ -163,6 +183,8 @@ For **macOS** and **Windows** users, the CUDA version is not supported. Don't confuse with `GPU version <#build-gpu-version>`__. To use the CUDA version within Python, pass ``{"device": "cuda"}`` respectively in parameters. +| + Build with MinGW-w64 on Windows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -175,6 +197,8 @@ Build with MinGW-w64 on Windows It is recommended to use **Visual Studio** for its better multithreading efficiency in **Windows** for many-core systems (see `Question 4 `__ and `Question 8 `__). +| + Build 32-bit Version with 32-bit Python ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -184,6 +208,8 @@ Build 32-bit Version with 32-bit Python It is **strongly not recommended** to use this version of LightGBM! +| + Build without Searching in Homebrew Folders for Dependencies on macOS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -193,6 +219,8 @@ Build without Searching in Homebrew Folders for Dependencies on macOS Use this option to stop looking into Homebrew standard folders for finding dependencies (e.g. OpenMP) during the build on macOS. +| + Build with Time Costs Output ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -202,6 +230,8 @@ Build with Time Costs Output Use this option to make LightGBM output time costs for different internal routines, to investigate and benchmark its performance. +| + Build in Debug Mode ~~~~~~~~~~~~~~~~~~~ @@ -211,6 +241,8 @@ Build in Debug Mode Use this mode to make LightGBM perform more checks internally and disable all compiler optimizations. +| + Build with Sanitizers ~~~~~~~~~~~~~~~~~~~~~ @@ -222,6 +254,8 @@ Use this option to build LightGBM with compiler sanitizers. For more details see `Installation Guide `__. +| + Install from `conda-forge channel `_ ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' From d818fb8c9ed4296c3b8733d6b2ff393a6d6230a2 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 03:00:43 +0300 Subject: [PATCH 032/112] Update README.rst --- python-package/README.rst | 42 ++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index 5a8ac9e65d98..255d4387317e 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -11,6 +11,25 @@ Preparation 32-bit Python is not supported. Please install 64-bit version. If you have a strong need to install with 32-bit Python, refer to `Build 32-bit Version with 32-bit Python section <#build-32-bit-version-with-32-bit-python>`__. +| + +Install from `conda-forge channel `_ +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +``lightgbm`` conda packages are available from the ``conda-forge`` channel. + +This is the preffered way to install LightGBM Python-package. + +.. code:: sh + + conda install -c conda-forge lightgbm + +These packages support **CPU**, **GPU** and **CUDA** versions out of the box. +**GPU**-enabled version is available only for **Windows** and **Linux** currently. +**CUDA**-enabled version (since ``lightgbm>=4.4.0``) is available only for **Linux** currently and will be automatically selected if you are on a system where CUDA is installed. + +| + Install from `PyPI `_ '''''''''''''''''''''''''''''''''''''''''''''''''''''''' @@ -256,29 +275,6 @@ For more details see `Installation Guide `_ -''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' - -``lightgbm`` conda packages are available from the ``conda-forge`` channel. - -.. code:: sh - - 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: - -* you prefer to use ``conda`` to manage software environments -* you want to use GPU-accelerated LightGBM -* you are using a platform that ``lightgbm`` does not provide wheels for (like PowerPC) - -For ``lightgbm>=4.4.0``, if you are on a system where CUDA is installed, ``conda install`` will automatically -select a CUDA-enabled build of ``lightgbm``. - -.. code:: sh - - conda install -c conda-forge 'lightgbm>=4.4.0' - Install from GitHub ''''''''''''''''''' From 4eaf198e89e882001ea1499f169bacd24c45f57d Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 03:01:18 +0300 Subject: [PATCH 033/112] Update README.rst --- python-package/README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-package/README.rst b/python-package/README.rst index 255d4387317e..d773d1410c83 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -25,7 +25,9 @@ This is the preffered way to install LightGBM Python-package. conda install -c conda-forge lightgbm These packages support **CPU**, **GPU** and **CUDA** versions out of the box. + **GPU**-enabled version is available only for **Windows** and **Linux** currently. + **CUDA**-enabled version (since ``lightgbm>=4.4.0``) is available only for **Linux** currently and will be automatically selected if you are on a system where CUDA is installed. | From ca2fee12a172f094a4ad6e301f623da010689eae Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 03:01:41 +0300 Subject: [PATCH 034/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index d773d1410c83..51440b96b289 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -18,7 +18,7 @@ Install from `conda-forge channel `_ ``lightgbm`` conda packages are available from the ``conda-forge`` channel. -This is the preffered way to install LightGBM Python-package. +This is the preferred way to install LightGBM Python-package. .. code:: sh From c09506a9983cb848d85721fac60adbd9964a055d Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 03:14:49 +0300 Subject: [PATCH 035/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index 51440b96b289..3d2bb52801ea 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -61,7 +61,7 @@ To install all dependencies needed to use ``PyArrow`` in LightGBM, append ``[arr Use LightGBM with Dask ********************** -Dask-package is only tested on Linux. +Warning: Dask-package is only tested on Linux. To install all dependencies needed to use ``lightgbm.dask``, append ``[dask]``. From ec9cd50ddf0971af1fa70e1c0b6745f179130d44 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sat, 21 Dec 2024 03:40:57 +0300 Subject: [PATCH 036/112] Update README.rst --- python-package/README.rst | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index 3d2bb52801ea..a3b79688d938 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -13,25 +13,6 @@ Preparation | -Install from `conda-forge channel `_ -''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' - -``lightgbm`` conda packages are available from the ``conda-forge`` channel. - -This is the preferred way to install LightGBM Python-package. - -.. code:: sh - - conda install -c conda-forge lightgbm - -These packages support **CPU**, **GPU** and **CUDA** versions out of the box. - -**GPU**-enabled version is available only for **Windows** and **Linux** currently. - -**CUDA**-enabled version (since ``lightgbm>=4.4.0``) is available only for **Linux** currently and will be automatically selected if you are on a system where CUDA is installed. - -| - Install from `PyPI `_ '''''''''''''''''''''''''''''''''''''''''''''''''''''''' @@ -277,6 +258,23 @@ For more details see `Installation Guide `_ +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +``lightgbm`` conda packages are available from the ``conda-forge`` channel. + +.. code:: sh + + conda install -c conda-forge lightgbm + +These packages support **CPU**, **GPU** and **CUDA** versions out of the box. + +**GPU**-enabled version is available only for **Windows** and **Linux** currently. + +**CUDA**-enabled version (since ``lightgbm>=4.4.0``) is available only for **Linux** currently and will be automatically selected if you are on a system where CUDA is installed. + +| + Install from GitHub ''''''''''''''''''' From 8148b6916751d4d6eef743bde3332ff18608467e Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sun, 22 Dec 2024 15:32:24 +0300 Subject: [PATCH 037/112] Update README.rst --- python-package/README.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index a3b79688d938..c103758dd52b 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -280,8 +280,6 @@ Install from GitHub All requirements from `Build from Sources section <#build-from-sources>`__ apply for this installation option as well. -For **Windows** users, if you get any errors during installation and there is the warning ``WARNING:LightGBM:Compilation with MSBuild from existing solution file failed.`` in the log. - .. code:: sh git clone --recursive https://github.com/microsoft/LightGBM.git From acfe30d79f02f202f8bcccffc0c7d6c50b8ec624 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sun, 22 Dec 2024 15:44:58 +0300 Subject: [PATCH 038/112] Update README.rst --- python-package/README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/python-package/README.rst b/python-package/README.rst index c103758dd52b..e19ef274daa2 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -283,6 +283,7 @@ All requirements from `Build from Sources section <#build-from-sources>`__ apply .. code:: sh git clone --recursive https://github.com/microsoft/LightGBM.git + cd LightGBM # export CXX=g++-14 CC=gcc-14 # macOS users, if you decided to compile with gcc, don't forget to specify compilers sh ./build-python.sh install From 8ed111fd594342bab11e1dfc815ff4c57ff49831 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sun, 22 Dec 2024 16:23:57 +0300 Subject: [PATCH 039/112] Update pyproject.toml --- python-package/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/pyproject.toml b/python-package/pyproject.toml index e4a3c73a7ce5..e0b2ad5a558a 100644 --- a/python-package/pyproject.toml +++ b/python-package/pyproject.toml @@ -82,7 +82,7 @@ minimum-version = "build-system.requires" [tool.scikit-build.cmake] version = "CMakeLists.txt" -cmake.build-type = "Release" +build-type = "Release" [tool.scikit-build.cmake.define] __BUILD_FOR_PYTHON = "ON" From 02f4b951df70ce16fc5b3aa0159841bce3aa2efc Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sun, 22 Dec 2024 16:49:10 +0300 Subject: [PATCH 040/112] Update README.rst --- python-package/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index e19ef274daa2..54a55fc01daf 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -293,12 +293,12 @@ Run ``sh ./build-python.sh install --nomp`` to disable **OpenMP** support. All r 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. - Run ``sh ./build-python.sh install --gpu`` to enable GPU support. All requirements from `Build GPU Version section <#build-gpu-version>`__ apply for this installation option as well. To pass additional options to **CMake** use the following syntax: ``sh ./build-python.sh install --gpu --opencl-include-dir="/usr/local/cuda/include/"``, see `Build GPU Version section <#build-gpu-version>`__ for the complete list of them. Run ``sh ./build-python.sh install --cuda`` to enable CUDA support. All requirements from `Build CUDA Version section <#build-cuda-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. + Run ``sh ./build-python.sh install --bit32``, if you want to use 32-bit version. All requirements from `Build 32-bit Version with 32-bit Python section <#build-32-bit-version-with-32-bit-python>`__ apply for this installation option as well. Run ``sh ./build-python.sh install --time-costs``, if you want to output time costs for different internal routines. All requirements from `Build with Time Costs Output section <#build-with-time-costs-output>`__ apply for this installation option as well. From ec24127a378d363afdfe1b614cdfe2121ca8abfb Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sun, 22 Dec 2024 21:27:50 +0300 Subject: [PATCH 041/112] Update README.rst From 5f294316b5ede4d660afaadae22d6efd370ad1ff Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sun, 22 Dec 2024 23:13:02 +0300 Subject: [PATCH 042/112] Update build-python.sh --- build-python.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build-python.sh b/build-python.sh index ff37e4afe225..29afd38f1417 100755 --- a/build-python.sh +++ b/build-python.sh @@ -150,9 +150,8 @@ while [ $# -gt 0 ]; do BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.__INTEGRATE_OPENCL=ON" ;; --mingw) - export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND" + BUILD_ARGS="${BUILD_ARGS} --config-settings=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-settings=cmake.args='-GMinGW Makefiles'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From 6555396ba0bc81300758c42943d8ce3584f3d8d9 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sun, 22 Dec 2024 23:17:45 +0300 Subject: [PATCH 043/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 29afd38f1417..81e5da714ba9 100755 --- a/build-python.sh +++ b/build-python.sh @@ -151,7 +151,7 @@ while [ $# -gt 0 ]; do ;; --mingw) # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-settings=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-settings=cmake.args='-GMinGW Makefiles'" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args='-GMinGW Makefiles'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From d0fe127bf1693ad0766e4fa7b086944f6fc62be6 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sun, 22 Dec 2024 23:42:23 +0300 Subject: [PATCH 044/112] Update build-python.sh --- build-python.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 81e5da714ba9..ff37e4afe225 100755 --- a/build-python.sh +++ b/build-python.sh @@ -150,8 +150,9 @@ while [ $# -gt 0 ]; do BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.__INTEGRATE_OPENCL=ON" ;; --mingw) + export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args='-GMinGW Makefiles'" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From ff3e4c7c4adaf41b636555126b4e703e846b2e4a Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sun, 22 Dec 2024 23:49:42 +0300 Subject: [PATCH 045/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index ff37e4afe225..257ef21d4835 100755 --- a/build-python.sh +++ b/build-python.sh @@ -152,7 +152,7 @@ while [ $# -gt 0 ]; do --mingw) export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=\"-GMinGW Makefiles\"" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From 73334ca3699deaf3e700ccd1d44fa9016cf96a54 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sun, 22 Dec 2024 23:54:40 +0300 Subject: [PATCH 046/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 257ef21d4835..8accb4341031 100755 --- a/build-python.sh +++ b/build-python.sh @@ -152,7 +152,7 @@ while [ $# -gt 0 ]; do --mingw) export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=\"-GMinGW Makefiles\"" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args='${CMAKE_GENERATOR}'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From 726ef96cf7ef515fc9b5eb7ac62333aba45e96da Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Sun, 22 Dec 2024 23:58:48 +0300 Subject: [PATCH 047/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 8accb4341031..b30bf1e15979 100755 --- a/build-python.sh +++ b/build-python.sh @@ -152,7 +152,7 @@ while [ $# -gt 0 ]; do --mingw) export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args='${CMAKE_GENERATOR}'" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=MinGW" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From a9a534c473c841ff0801726bba218be8f3d13850 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 00:09:11 +0300 Subject: [PATCH 048/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index b30bf1e15979..c622e67b1da0 100755 --- a/build-python.sh +++ b/build-python.sh @@ -152,7 +152,7 @@ while [ $# -gt 0 ]; do --mingw) export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=MinGW" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args="'-GMinGW Makefiles'"" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From 848a536d97055a25143359d736a8fc9926c5fed0 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 00:14:11 +0300 Subject: [PATCH 049/112] Update build-python.sh --- build-python.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-python.sh b/build-python.sh index c622e67b1da0..d18ba6efd701 100755 --- a/build-python.sh +++ b/build-python.sh @@ -150,9 +150,9 @@ while [ $# -gt 0 ]; do BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.__INTEGRATE_OPENCL=ON" ;; --mingw) - export CMAKE_GENERATOR='MinGW Makefiles' + export CMAKE_GENERATOR='MinGW Makefiles' 'abc'\''abc' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args="'-GMinGW Makefiles'"" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args="\""-GMinGW Makefiles"\"" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From 784fcba3ea5545d5a523b8420ca675b12fb96928 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 00:19:27 +0300 Subject: [PATCH 050/112] Update build-python.sh --- build-python.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-python.sh b/build-python.sh index d18ba6efd701..cbccef137f5b 100755 --- a/build-python.sh +++ b/build-python.sh @@ -150,9 +150,9 @@ while [ $# -gt 0 ]; do BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.__INTEGRATE_OPENCL=ON" ;; --mingw) - export CMAKE_GENERATOR='MinGW Makefiles' 'abc'\''abc' + export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args="\""-GMinGW Makefiles"\"" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args="'"'"-GMinGW Makefiles"'"'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From cc8a24e3477222ad16620a9157b49c331b93996a Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 00:24:19 +0300 Subject: [PATCH 051/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index cbccef137f5b..16a197ac0d57 100755 --- a/build-python.sh +++ b/build-python.sh @@ -152,7 +152,7 @@ while [ $# -gt 0 ]; do --mingw) export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args="'"'"-GMinGW Makefiles"'"'" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args='-GMinGW Makefiles'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From 03bd3c93045342851c93c55a4ccb2aaef69b2583 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 00:28:13 +0300 Subject: [PATCH 052/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 16a197ac0d57..7714aa962010 100755 --- a/build-python.sh +++ b/build-python.sh @@ -289,7 +289,7 @@ create_isolated_source_dir() { create_isolated_source_dir cd ./lightgbm-python - +echo ${BUILD_ARGS} # installation involves building the wheel + `pip install`-ing it if test "${INSTALL}" = true; then if test "${PRECOMPILE}" = true; then From 4cd32ce1d58702c1bcc1fa7d98378eee652938db Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 00:36:19 +0300 Subject: [PATCH 053/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 7714aa962010..5264ad15f6cc 100755 --- a/build-python.sh +++ b/build-python.sh @@ -152,7 +152,7 @@ while [ $# -gt 0 ]; do --mingw) export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args='-GMinGW Makefiles'" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args='-GMinGW\ Makefiles'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From 19a07e20b0a349509f0992463002f23e9e24cbf2 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 00:41:36 +0300 Subject: [PATCH 054/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 5264ad15f6cc..d6fd8e1a8d80 100755 --- a/build-python.sh +++ b/build-python.sh @@ -152,7 +152,7 @@ while [ $# -gt 0 ]; do --mingw) export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args='-GMinGW\ Makefiles'" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args='-GMinGWMakefiles'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From e9cced72f1447af29412ea64acf3693733c60ff4 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 00:44:35 +0300 Subject: [PATCH 055/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index d6fd8e1a8d80..d3ab96ad6a4d 100755 --- a/build-python.sh +++ b/build-python.sh @@ -152,7 +152,7 @@ while [ $# -gt 0 ]; do --mingw) export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args='-GMinGWMakefiles'" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=-G'MinGWMakefiles'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From ac34770df5479812b7797d6f00a1ce261b2a3f65 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 01:02:04 +0300 Subject: [PATCH 056/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index d3ab96ad6a4d..51c403e69463 100755 --- a/build-python.sh +++ b/build-python.sh @@ -152,7 +152,7 @@ while [ $# -gt 0 ]; do --mingw) export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=-G'MinGWMakefiles'" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=-G'MinGW Makefiles'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From f7b8e7c3492e38dda94a5d7f8b722730747eff04 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 01:12:27 +0300 Subject: [PATCH 057/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 51c403e69463..538f415c2c21 100755 --- a/build-python.sh +++ b/build-python.sh @@ -152,7 +152,7 @@ while [ $# -gt 0 ]; do --mingw) export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=-G'MinGW Makefiles'" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=-G'MinGW\ Makefiles'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From ddb52b98414bd9bc4f4bd3529d046d424e6008dc Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 02:13:30 +0300 Subject: [PATCH 058/112] Update build-python.sh --- build-python.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-python.sh b/build-python.sh index 538f415c2c21..5566477db80f 100755 --- a/build-python.sh +++ b/build-python.sh @@ -342,7 +342,7 @@ if test "${BUILD_SDIST}" = true; then python -m build \ --sdist \ --outdir ../dist \ - ${BUILD_ARGS} \ + $(echo "${BUILD_ARGS}" | sed -e 's@#@ @g' | xargs -n 1) \ . fi @@ -353,7 +353,7 @@ if test "${BUILD_WHEEL}" = true; then python -m build \ --wheel \ --outdir ../dist \ - ${BUILD_ARGS} \ + $(echo "${BUILD_ARGS}" | sed -e 's@#@ @g' | xargs -n 1) \ . fi From b07feda6982c2bdce8248e3fc0afff6716d726dc Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 02:17:56 +0300 Subject: [PATCH 059/112] Update build-python.sh --- build-python.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build-python.sh b/build-python.sh index 5566477db80f..e9dafc49fb8a 100755 --- a/build-python.sh +++ b/build-python.sh @@ -150,9 +150,8 @@ while [ $# -gt 0 ]; do BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.__INTEGRATE_OPENCL=ON" ;; --mingw) - export CMAKE_GENERATOR='MinGW Makefiles' # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=-G'MinGW\ Makefiles'" + BUILD_ARGS="${BUILD_ARGS}#--config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND#--config-setting=cmake.args=-G'MinGW Makefiles'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From 9d065ce59740e3f078119bae039c952893a83990 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 06:30:52 +0300 Subject: [PATCH 060/112] Update build-python.sh --- build-python.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build-python.sh b/build-python.sh index e9dafc49fb8a..758b30b3bc6b 100755 --- a/build-python.sh +++ b/build-python.sh @@ -151,7 +151,7 @@ while [ $# -gt 0 ]; do ;; --mingw) # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS}#--config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND#--config-setting=cmake.args=-G'MinGW Makefiles'" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=-G\'MinGW\ Makefiles\'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" @@ -341,7 +341,7 @@ if test "${BUILD_SDIST}" = true; then python -m build \ --sdist \ --outdir ../dist \ - $(echo "${BUILD_ARGS}" | sed -e 's@#@ @g' | xargs -n 1) \ + $(echo "${BUILD_ARGS}" | xargs -n 1) \ . fi @@ -352,7 +352,7 @@ if test "${BUILD_WHEEL}" = true; then python -m build \ --wheel \ --outdir ../dist \ - $(echo "${BUILD_ARGS}" | sed -e 's@#@ @g' | xargs -n 1) \ + $(echo "${BUILD_ARGS}" | xargs -n 1) \ . fi From 53b8e1940691b60eabc4fa7815c034cdb0900c88 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 08:17:02 +0300 Subject: [PATCH 061/112] Update build-python.sh --- build-python.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build-python.sh b/build-python.sh index 758b30b3bc6b..197061e2b2a2 100755 --- a/build-python.sh +++ b/build-python.sh @@ -151,7 +151,7 @@ while [ $# -gt 0 ]; do ;; --mingw) # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=-G\'MinGW\ Makefiles\'" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=-G'MinGW Makefiles'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" @@ -288,7 +288,7 @@ create_isolated_source_dir() { create_isolated_source_dir cd ./lightgbm-python -echo ${BUILD_ARGS} + # installation involves building the wheel + `pip install`-ing it if test "${INSTALL}" = true; then if test "${PRECOMPILE}" = true; then @@ -341,7 +341,7 @@ if test "${BUILD_SDIST}" = true; then python -m build \ --sdist \ --outdir ../dist \ - $(echo "${BUILD_ARGS}" | xargs -n 1) \ + ${BUILD_ARGS/ /} \ . fi @@ -352,7 +352,7 @@ if test "${BUILD_WHEEL}" = true; then python -m build \ --wheel \ --outdir ../dist \ - $(echo "${BUILD_ARGS}" | xargs -n 1) \ + ${BUILD_ARGS/ /} \ . fi From 4b3c98a711be5e4b17b2b9addc40e1b339900919 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 08:27:22 +0300 Subject: [PATCH 062/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 197061e2b2a2..7b52485d803e 100755 --- a/build-python.sh +++ b/build-python.sh @@ -288,7 +288,7 @@ create_isolated_source_dir() { create_isolated_source_dir cd ./lightgbm-python - +echo $BUILD_ARGS # installation involves building the wheel + `pip install`-ing it if test "${INSTALL}" = true; then if test "${PRECOMPILE}" = true; then From e3a4836aab8f0e064af4f5428835223dd8ece8de Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 08:31:12 +0300 Subject: [PATCH 063/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 7b52485d803e..bbd90db1109e 100755 --- a/build-python.sh +++ b/build-python.sh @@ -352,7 +352,7 @@ if test "${BUILD_WHEEL}" = true; then python -m build \ --wheel \ --outdir ../dist \ - ${BUILD_ARGS/ /} \ + ${BUILD_ARGS} \ . fi From d99d0cf6bd90fdef4fdba4c8826f56a882e1393f Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 08:36:25 +0300 Subject: [PATCH 064/112] Update build-python.sh --- build-python.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-python.sh b/build-python.sh index bbd90db1109e..6f115bbd8965 100755 --- a/build-python.sh +++ b/build-python.sh @@ -341,7 +341,7 @@ if test "${BUILD_SDIST}" = true; then python -m build \ --sdist \ --outdir ../dist \ - ${BUILD_ARGS/ /} \ + $(echo ${BUILD_ARGS} | xargs) \ . fi @@ -352,7 +352,7 @@ if test "${BUILD_WHEEL}" = true; then python -m build \ --wheel \ --outdir ../dist \ - ${BUILD_ARGS} \ + $(echo ${BUILD_ARGS} | xargs) \ . fi From a592c54a570092ec44c87f0827024c414f00f9c0 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 23 Dec 2024 09:41:02 +0300 Subject: [PATCH 065/112] Update build-python.sh --- build-python.sh | 57 +++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/build-python.sh b/build-python.sh index 6f115bbd8965..01aec870d21a 100755 --- a/build-python.sh +++ b/build-python.sh @@ -95,42 +95,42 @@ while [ $# -gt 0 ]; do then shift; fi BOOST_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.Boost_DIR='${BOOST_DIR}'" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.Boost_DIR='${BOOST_DIR}'" ;; --boost-include-dir|--boost-include-dir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_INCLUDE_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.Boost_INCLUDE_DIR='${BOOST_INCLUDE_DIR}'" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.Boost_INCLUDE_DIR='${BOOST_INCLUDE_DIR}'" ;; --boost-librarydir|--boost-librarydir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_LIBRARY_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.BOOST_LIBRARYDIR='${BOOST_LIBRARY_DIR}'" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.BOOST_LIBRARYDIR='${BOOST_LIBRARY_DIR}'" ;; --boost-root|--boost-root=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_ROOT="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.Boost_ROOT='${BOOST_ROOT}'" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.Boost_ROOT='${BOOST_ROOT}'" ;; --opencl-include-dir|--opencl-include-dir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi OPENCL_INCLUDE_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.OpenCL_INCLUDE_DIR='${OPENCL_INCLUDE_DIR}'" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.OpenCL_INCLUDE_DIR='${OPENCL_INCLUDE_DIR}'" ;; --opencl-library|--opencl-library=*) if echo "$1" | grep -q '^*=*$'; then shift; fi OPENCL_LIBRARY="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.OpenCL_LIBRARY='${OPENCL_LIBRARY}'" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.OpenCL_LIBRARY='${OPENCL_LIBRARY}'" ;; ######### # flags # @@ -141,33 +141,33 @@ while [ $# -gt 0 ]; do echo "[INFO] Attempting to build 32-bit version of LightGBM, which is only supported on Windows with generator '${CMAKE_GENERATOR}'." ;; --cuda) - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_CUDA=ON" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.USE_CUDA=ON" ;; --gpu) - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_GPU=ON" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.USE_GPU=ON" ;; --integrated-opencl) - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.__INTEGRATE_OPENCL=ON" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.__INTEGRATE_OPENCL=ON" ;; --mingw) # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=-G'MinGW Makefiles'" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND;--config-setting=cmake.args=-G'MinGW Makefiles'" ;; --mpi) - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.USE_MPI=ON" ;; --no-isolation) - BUILD_ARGS="${BUILD_ARGS} --no-isolation" + BUILD_ARGS="${BUILD_ARGS};--no-isolation" PIP_INSTALL_ARGS="${PIP_INSTALL_ARGS} --no-build-isolation" ;; --nomp) - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_OPENMP=OFF" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.USE_OPENMP=OFF" ;; --precompile) PRECOMPILE="true" ;; --time-costs) - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_TIMETAG=ON" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.USE_TIMETAG=ON" ;; --user) PIP_INSTALL_ARGS="${PIP_INSTALL_ARGS} --user" @@ -289,6 +289,7 @@ create_isolated_source_dir cd ./lightgbm-python echo $BUILD_ARGS +export IFS=';' # installation involves building the wheel + `pip install`-ing it if test "${INSTALL}" = true; then if test "${PRECOMPILE}" = true; then @@ -337,23 +338,27 @@ fi if test "${BUILD_SDIST}" = true; then echo "--- building sdist ---" rm -f ../dist/*.tar.gz - # shellcheck disable=SC2086 - python -m build \ - --sdist \ - --outdir ../dist \ - $(echo ${BUILD_ARGS} | xargs) \ - . + ( + # shellcheck disable=SC2086 + python -m build \ + --sdist \ + --outdir ../dist \ + $(echo ${BUILD_ARGS} | xargs) \ + . + ) fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true - # shellcheck disable=SC2086 - python -m build \ - --wheel \ - --outdir ../dist \ - $(echo ${BUILD_ARGS} | xargs) \ - . + ( + # shellcheck disable=SC2086 + python -m build \ + --wheel \ + --outdir ../dist \ + $(echo ${BUILD_ARGS} | xargs) \ + . + ) fi if test "${INSTALL}" = true; then From df3f69d099726b12b385e0bc8d0145d0451eea97 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 01:45:48 +0300 Subject: [PATCH 066/112] Update build-python.sh --- build-python.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 01aec870d21a..e1208c2a6368 100755 --- a/build-python.sh +++ b/build-python.sh @@ -289,7 +289,6 @@ create_isolated_source_dir cd ./lightgbm-python echo $BUILD_ARGS -export IFS=';' # installation involves building the wheel + `pip install`-ing it if test "${INSTALL}" = true; then if test "${PRECOMPILE}" = true; then @@ -339,6 +338,7 @@ if test "${BUILD_SDIST}" = true; then echo "--- building sdist ---" rm -f ../dist/*.tar.gz ( + export IFS=';' # shellcheck disable=SC2086 python -m build \ --sdist \ @@ -352,6 +352,7 @@ if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true ( + export IFS=';' # shellcheck disable=SC2086 python -m build \ --wheel \ From dd710f5602a849d36cce59508677771a28823e45 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 01:50:27 +0300 Subject: [PATCH 067/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index e1208c2a6368..0fbcdb21edf9 100755 --- a/build-python.sh +++ b/build-python.sh @@ -151,7 +151,7 @@ while [ $# -gt 0 ]; do ;; --mingw) # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND;--config-setting=cmake.args=-G'MinGW Makefiles'" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND;--config-setting=cmake.args=-G'MinGW Makefiles';" ;; --mpi) BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.USE_MPI=ON" From 3fc761f0af95c13de2a2b764b1ab957046c39f76 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 02:06:25 +0300 Subject: [PATCH 068/112] Update build-python.sh --- build-python.sh | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/build-python.sh b/build-python.sh index 0fbcdb21edf9..133a3acf645a 100755 --- a/build-python.sh +++ b/build-python.sh @@ -337,29 +337,15 @@ fi if test "${BUILD_SDIST}" = true; then echo "--- building sdist ---" rm -f ../dist/*.tar.gz - ( - export IFS=';' - # shellcheck disable=SC2086 - python -m build \ - --sdist \ - --outdir ../dist \ - $(echo ${BUILD_ARGS} | xargs) \ - . - ) + export IFS=';' + echo ${BUILD_ARGS} | xargs python -m build --wheel --outdir ../dist . fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true - ( - export IFS=';' - # shellcheck disable=SC2086 - python -m build \ - --wheel \ - --outdir ../dist \ - $(echo ${BUILD_ARGS} | xargs) \ - . - ) + export IFS=';' + echo ${BUILD_ARGS} | xargs python -m build --wheel --outdir ../dist . fi if test "${INSTALL}" = true; then From 3bee691c07edba51745e8b2caa21e73050bf6edb Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 02:42:24 +0300 Subject: [PATCH 069/112] Update build-python.sh --- build-python.sh | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/build-python.sh b/build-python.sh index 133a3acf645a..a84e8a47c15d 100755 --- a/build-python.sh +++ b/build-python.sh @@ -64,6 +64,11 @@ set -e -u echo "building lightgbm" +# put a string in a shell-quoted form +quote () { + printf %s\\n "$1" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/'/" +} + # Default values of arguments INSTALL="false" BUILD_SDIST="false" @@ -95,42 +100,42 @@ while [ $# -gt 0 ]; do then shift; fi BOOST_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.Boost_DIR='${BOOST_DIR}'" + BUILD_ARGS="${BUILD_ARGS};$(quote "--config-setting=cmake.define.Boost_DIR='${BOOST_DIR}'")" ;; --boost-include-dir|--boost-include-dir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_INCLUDE_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.Boost_INCLUDE_DIR='${BOOST_INCLUDE_DIR}'" + BUILD_ARGS="${BUILD_ARGS};$(quote "--config-setting=cmake.define.Boost_INCLUDE_DIR='${BOOST_INCLUDE_DIR}'")" ;; --boost-librarydir|--boost-librarydir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_LIBRARY_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.BOOST_LIBRARYDIR='${BOOST_LIBRARY_DIR}'" + BUILD_ARGS="${BUILD_ARGS};$(quote "--config-setting=cmake.define.BOOST_LIBRARYDIR='${BOOST_LIBRARY_DIR}'")" ;; --boost-root|--boost-root=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_ROOT="${1#*=}" - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.Boost_ROOT='${BOOST_ROOT}'" + BUILD_ARGS="${BUILD_ARGS};$(quote "--config-setting=cmake.define.Boost_ROOT='${BOOST_ROOT}'")" ;; --opencl-include-dir|--opencl-include-dir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi OPENCL_INCLUDE_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.OpenCL_INCLUDE_DIR='${OPENCL_INCLUDE_DIR}'" + BUILD_ARGS="${BUILD_ARGS};$(quote "--config-setting=cmake.define.OpenCL_INCLUDE_DIR='${OPENCL_INCLUDE_DIR}'")" ;; --opencl-library|--opencl-library=*) if echo "$1" | grep -q '^*=*$'; then shift; fi OPENCL_LIBRARY="${1#*=}" - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.OpenCL_LIBRARY='${OPENCL_LIBRARY}'" + BUILD_ARGS="${BUILD_ARGS};$(quote "--config-setting=cmake.define.OpenCL_LIBRARY='${OPENCL_LIBRARY}'")" ;; ######### # flags # @@ -151,7 +156,7 @@ while [ $# -gt 0 ]; do ;; --mingw) # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND;--config-setting=cmake.args=-G'MinGW Makefiles';" + BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND;$(quote "--config-setting=cmake.args=-G'MinGW Makefiles'")" ;; --mpi) BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.USE_MPI=ON" @@ -337,15 +342,27 @@ fi if test "${BUILD_SDIST}" = true; then echo "--- building sdist ---" rm -f ../dist/*.tar.gz - export IFS=';' - echo ${BUILD_ARGS} | xargs python -m build --wheel --outdir ../dist . + echo ${BUILD_ARGS} \ + | xargs \ + python \ + -m build \ + --wheel \ + --outdir \ + ../dist \ + . fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true - export IFS=';' - echo ${BUILD_ARGS} | xargs python -m build --wheel --outdir ../dist . + echo ${BUILD_ARGS} \ + | xargs \ + python \ + -m build \ + --wheel \ + --outdir \ + ../dist \ + . fi if test "${INSTALL}" = true; then From f160bcff0596a906be1ac88677c5ab7f8f0b5d75 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 02:47:52 +0300 Subject: [PATCH 070/112] Update build-python.sh --- build-python.sh | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/build-python.sh b/build-python.sh index a84e8a47c15d..6449b205c66a 100755 --- a/build-python.sh +++ b/build-python.sh @@ -100,42 +100,42 @@ while [ $# -gt 0 ]; do then shift; fi BOOST_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS};$(quote "--config-setting=cmake.define.Boost_DIR='${BOOST_DIR}'")" + BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.Boost_DIR='${BOOST_DIR}'")" ;; --boost-include-dir|--boost-include-dir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_INCLUDE_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS};$(quote "--config-setting=cmake.define.Boost_INCLUDE_DIR='${BOOST_INCLUDE_DIR}'")" + BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.Boost_INCLUDE_DIR='${BOOST_INCLUDE_DIR}'")" ;; --boost-librarydir|--boost-librarydir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_LIBRARY_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS};$(quote "--config-setting=cmake.define.BOOST_LIBRARYDIR='${BOOST_LIBRARY_DIR}'")" + BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.BOOST_LIBRARYDIR='${BOOST_LIBRARY_DIR}'")" ;; --boost-root|--boost-root=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_ROOT="${1#*=}" - BUILD_ARGS="${BUILD_ARGS};$(quote "--config-setting=cmake.define.Boost_ROOT='${BOOST_ROOT}'")" + BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.Boost_ROOT='${BOOST_ROOT}'")" ;; --opencl-include-dir|--opencl-include-dir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi OPENCL_INCLUDE_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS};$(quote "--config-setting=cmake.define.OpenCL_INCLUDE_DIR='${OPENCL_INCLUDE_DIR}'")" + BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.OpenCL_INCLUDE_DIR='${OPENCL_INCLUDE_DIR}'")" ;; --opencl-library|--opencl-library=*) if echo "$1" | grep -q '^*=*$'; then shift; fi OPENCL_LIBRARY="${1#*=}" - BUILD_ARGS="${BUILD_ARGS};$(quote "--config-setting=cmake.define.OpenCL_LIBRARY='${OPENCL_LIBRARY}'")" + BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.OpenCL_LIBRARY='${OPENCL_LIBRARY}'")" ;; ######### # flags # @@ -146,33 +146,33 @@ while [ $# -gt 0 ]; do echo "[INFO] Attempting to build 32-bit version of LightGBM, which is only supported on Windows with generator '${CMAKE_GENERATOR}'." ;; --cuda) - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.USE_CUDA=ON" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_CUDA=ON" ;; --gpu) - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.USE_GPU=ON" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_GPU=ON" ;; --integrated-opencl) - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.__INTEGRATE_OPENCL=ON" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.__INTEGRATE_OPENCL=ON" ;; --mingw) # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND;$(quote "--config-setting=cmake.args=-G'MinGW Makefiles'")" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND $(quote "--config-setting=cmake.args=-G'MinGW Makefiles'")" ;; --mpi) - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.USE_MPI=ON" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" ;; --no-isolation) - BUILD_ARGS="${BUILD_ARGS};--no-isolation" + BUILD_ARGS="${BUILD_ARGS} --no-isolation" PIP_INSTALL_ARGS="${PIP_INSTALL_ARGS} --no-build-isolation" ;; --nomp) - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.USE_OPENMP=OFF" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_OPENMP=OFF" ;; --precompile) PRECOMPILE="true" ;; --time-costs) - BUILD_ARGS="${BUILD_ARGS};--config-setting=cmake.define.USE_TIMETAG=ON" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_TIMETAG=ON" ;; --user) PIP_INSTALL_ARGS="${PIP_INSTALL_ARGS} --user" @@ -342,26 +342,22 @@ fi if test "${BUILD_SDIST}" = true; then echo "--- building sdist ---" rm -f ../dist/*.tar.gz - echo ${BUILD_ARGS} \ + echo "${BUILD_ARGS}" \ | xargs \ - python \ - -m build \ - --wheel \ - --outdir \ - ../dist \ + python -m build \ + --sdist \ + --outdir ../dist \ . fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true - echo ${BUILD_ARGS} \ + echo "${BUILD_ARGS}" \ | xargs \ - python \ - -m build \ + python -m build \ --wheel \ - --outdir \ - ../dist \ + --outdir ../dist \ . fi From 866b46f7d618cdda5b2cc8f55278ed3304be8f9d Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 02:49:47 +0300 Subject: [PATCH 071/112] Update build-python.sh --- build-python.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build-python.sh b/build-python.sh index 6449b205c66a..f8edce4353f4 100755 --- a/build-python.sh +++ b/build-python.sh @@ -65,6 +65,7 @@ set -e -u echo "building lightgbm" # put a string in a shell-quoted form +# ref: https://www.reddit.com/r/bash/comments/1150jis/comment/j8zi8p2/ quote () { printf %s\\n "$1" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/'/" } From e7c9a8ef4ae276c2e5a6967e783e49a7eefb85a9 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 02:55:09 +0300 Subject: [PATCH 072/112] Update build-python.sh --- build-python.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-python.sh b/build-python.sh index f8edce4353f4..58c0b9c7d40f 100755 --- a/build-python.sh +++ b/build-python.sh @@ -343,7 +343,7 @@ fi if test "${BUILD_SDIST}" = true; then echo "--- building sdist ---" rm -f ../dist/*.tar.gz - echo "${BUILD_ARGS}" \ + echo ${BUILD_ARGS} \ | xargs \ python -m build \ --sdist \ @@ -354,7 +354,7 @@ fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true - echo "${BUILD_ARGS}" \ + echo ${BUILD_ARGS} \ | xargs \ python -m build \ --wheel \ From b85cc0fc8f3a6781ba29d8134f7fdb1cda2eca01 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 03:06:33 +0300 Subject: [PATCH 073/112] Update build-python.sh --- build-python.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/build-python.sh b/build-python.sh index 58c0b9c7d40f..a6f37efa47be 100755 --- a/build-python.sh +++ b/build-python.sh @@ -101,42 +101,42 @@ while [ $# -gt 0 ]; do then shift; fi BOOST_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.Boost_DIR='${BOOST_DIR}'")" + BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.Boost_DIR=${BOOST_DIR}")" ;; --boost-include-dir|--boost-include-dir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_INCLUDE_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.Boost_INCLUDE_DIR='${BOOST_INCLUDE_DIR}'")" + BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.Boost_INCLUDE_DIR=${BOOST_INCLUDE_DIR}")" ;; --boost-librarydir|--boost-librarydir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_LIBRARY_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.BOOST_LIBRARYDIR='${BOOST_LIBRARY_DIR}'")" + BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.BOOST_LIBRARYDIR=${BOOST_LIBRARY_DIR}")" ;; --boost-root|--boost-root=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_ROOT="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.Boost_ROOT='${BOOST_ROOT}'")" + BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.Boost_ROOT=${BOOST_ROOT}")" ;; --opencl-include-dir|--opencl-include-dir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi OPENCL_INCLUDE_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.OpenCL_INCLUDE_DIR='${OPENCL_INCLUDE_DIR}'")" + BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.OpenCL_INCLUDE_DIR=${OPENCL_INCLUDE_DIR}")" ;; --opencl-library|--opencl-library=*) if echo "$1" | grep -q '^*=*$'; then shift; fi OPENCL_LIBRARY="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.OpenCL_LIBRARY='${OPENCL_LIBRARY}'")" + BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.OpenCL_LIBRARY=${OPENCL_LIBRARY}")" ;; ######### # flags # @@ -157,7 +157,7 @@ while [ $# -gt 0 ]; do ;; --mingw) # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND $(quote "--config-setting=cmake.args=-G'MinGW Makefiles'")" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND $(quote "--config-setting=cmake.args=-GMinGW Makefiles")" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" @@ -343,7 +343,7 @@ fi if test "${BUILD_SDIST}" = true; then echo "--- building sdist ---" rm -f ../dist/*.tar.gz - echo ${BUILD_ARGS} \ + echo "${BUILD_ARGS}" \ | xargs \ python -m build \ --sdist \ @@ -354,7 +354,7 @@ fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true - echo ${BUILD_ARGS} \ + echo "${BUILD_ARGS}" \ | xargs \ python -m build \ --wheel \ From c9c5c04aa9868d22615121880f430ae73d96244a Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 03:14:12 +0300 Subject: [PATCH 074/112] Update build-python.sh --- build-python.sh | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/build-python.sh b/build-python.sh index a6f37efa47be..7f4bfcff81a8 100755 --- a/build-python.sh +++ b/build-python.sh @@ -64,12 +64,6 @@ set -e -u echo "building lightgbm" -# put a string in a shell-quoted form -# ref: https://www.reddit.com/r/bash/comments/1150jis/comment/j8zi8p2/ -quote () { - printf %s\\n "$1" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/'/" -} - # Default values of arguments INSTALL="false" BUILD_SDIST="false" @@ -101,42 +95,42 @@ while [ $# -gt 0 ]; do then shift; fi BOOST_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.Boost_DIR=${BOOST_DIR}")" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.Boost_DIR='${BOOST_DIR}'" ;; --boost-include-dir|--boost-include-dir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_INCLUDE_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.Boost_INCLUDE_DIR=${BOOST_INCLUDE_DIR}")" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.Boost_INCLUDE_DIR='${BOOST_INCLUDE_DIR}'" ;; --boost-librarydir|--boost-librarydir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_LIBRARY_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.BOOST_LIBRARYDIR=${BOOST_LIBRARY_DIR}")" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.BOOST_LIBRARYDIR='${BOOST_LIBRARY_DIR}'" ;; --boost-root|--boost-root=*) if echo "$1" | grep -q '^*=*$'; then shift; fi BOOST_ROOT="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.Boost_ROOT=${BOOST_ROOT}")" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.Boost_ROOT='${BOOST_ROOT}'" ;; --opencl-include-dir|--opencl-include-dir=*) if echo "$1" | grep -q '^*=*$'; then shift; fi OPENCL_INCLUDE_DIR="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.OpenCL_INCLUDE_DIR=${OPENCL_INCLUDE_DIR}")" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.OpenCL_INCLUDE_DIR='${OPENCL_INCLUDE_DIR}'" ;; --opencl-library|--opencl-library=*) if echo "$1" | grep -q '^*=*$'; then shift; fi OPENCL_LIBRARY="${1#*=}" - BUILD_ARGS="${BUILD_ARGS} $(quote "--config-setting=cmake.define.OpenCL_LIBRARY=${OPENCL_LIBRARY}")" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.OpenCL_LIBRARY='${OPENCL_LIBRARY}'" ;; ######### # flags # @@ -157,7 +151,7 @@ while [ $# -gt 0 ]; do ;; --mingw) # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND $(quote "--config-setting=cmake.args=-GMinGW Makefiles")" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=-G'MinGW Makefiles'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" @@ -294,7 +288,7 @@ create_isolated_source_dir() { create_isolated_source_dir cd ./lightgbm-python -echo $BUILD_ARGS + # installation involves building the wheel + `pip install`-ing it if test "${INSTALL}" = true; then if test "${PRECOMPILE}" = true; then From dbc9400789b6325c476dfaa20b4437f57394758d Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 03:49:17 +0300 Subject: [PATCH 075/112] Update build-python.sh --- build-python.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/build-python.sh b/build-python.sh index 7f4bfcff81a8..d312c5edaca4 100755 --- a/build-python.sh +++ b/build-python.sh @@ -348,12 +348,17 @@ fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true - echo "${BUILD_ARGS}" \ - | xargs \ - python -m build \ - --wheel \ - --outdir ../dist \ - . + # echo "${BUILD_ARGS}" \ + # | xargs \ + # python -m build \ + # --wheel \ + # --outdir ../dist \ + # . + python -m build \ + --wheel \ + --outdir ../dist \ + ${BUILD_ARGS} \ + . fi if test "${INSTALL}" = true; then From 00c31e362a8f7026e1c0b51af60b20a48351a00e Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 03:56:54 +0300 Subject: [PATCH 076/112] Update build-python.sh --- build-python.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/build-python.sh b/build-python.sh index d312c5edaca4..cce3053812b3 100755 --- a/build-python.sh +++ b/build-python.sh @@ -348,17 +348,12 @@ fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true - # echo "${BUILD_ARGS}" \ - # | xargs \ - # python -m build \ - # --wheel \ - # --outdir ../dist \ - # . - python -m build \ - --wheel \ - --outdir ../dist \ - ${BUILD_ARGS} \ - . + echo "${BUILD_ARGS}" | xargs python -m build --wheel --outdir ../dist . + # python -m build \ + # --wheel \ + # --outdir ../dist \ + # ${BUILD_ARGS} \ + # . fi if test "${INSTALL}" = true; then From 88d586ba69dc3bef17188bac0f4c1b7dfc93d1d3 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 04:08:52 +0300 Subject: [PATCH 077/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index cce3053812b3..d8946b63a2f0 100755 --- a/build-python.sh +++ b/build-python.sh @@ -348,7 +348,7 @@ fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true - echo "${BUILD_ARGS}" | xargs python -m build --wheel --outdir ../dist . + echo "${BUILD_ARGS}" | xargs -I{} python -m build --wheel --outdir ../dist {} . # python -m build \ # --wheel \ # --outdir ../dist \ From 9ae9c28eb2e570507781fb897df4f4dffab3954b Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 04:15:36 +0300 Subject: [PATCH 078/112] Update build-python.sh --- build-python.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build-python.sh b/build-python.sh index d8946b63a2f0..fb70e35a73cb 100755 --- a/build-python.sh +++ b/build-python.sh @@ -60,7 +60,7 @@ # Install into user-specific instead of global site-packages directory. # Only used with 'install' command. -set -e -u +# set -e -u echo "building lightgbm" @@ -348,7 +348,12 @@ fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true - echo "${BUILD_ARGS}" | xargs -I{} python -m build --wheel --outdir ../dist {} . + echo "${BUILD_ARGS}" \ + | xargs \ + python -m build \ + --wheel \ + --outdir ../dist \ + . # python -m build \ # --wheel \ # --outdir ../dist \ From 9f056cf9e7fa5a52db45a0126841af0bd874a9dc Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 04:20:51 +0300 Subject: [PATCH 079/112] Update build-python.sh --- build-python.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index fb70e35a73cb..cd84e3090120 100755 --- a/build-python.sh +++ b/build-python.sh @@ -349,10 +349,11 @@ if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true echo "${BUILD_ARGS}" \ - | xargs \ + | xargs -I{} \ python -m build \ --wheel \ --outdir ../dist \ + {} \ . # python -m build \ # --wheel \ From 2bd90f7696a1dc27dae92447bef0e37b21ba829e Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 04:27:33 +0300 Subject: [PATCH 080/112] Update build-python.sh --- build-python.sh | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/build-python.sh b/build-python.sh index cd84e3090120..d312c5edaca4 100755 --- a/build-python.sh +++ b/build-python.sh @@ -60,7 +60,7 @@ # Install into user-specific instead of global site-packages directory. # Only used with 'install' command. -# set -e -u +set -e -u echo "building lightgbm" @@ -348,18 +348,17 @@ fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true - echo "${BUILD_ARGS}" \ - | xargs -I{} \ - python -m build \ - --wheel \ - --outdir ../dist \ - {} \ - . - # python -m build \ - # --wheel \ - # --outdir ../dist \ - # ${BUILD_ARGS} \ - # . + # echo "${BUILD_ARGS}" \ + # | xargs \ + # python -m build \ + # --wheel \ + # --outdir ../dist \ + # . + python -m build \ + --wheel \ + --outdir ../dist \ + ${BUILD_ARGS} \ + . fi if test "${INSTALL}" = true; then From 3f043dd1a368bba0fc6db1182e41727f5388a5a3 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 04:32:23 +0300 Subject: [PATCH 081/112] Update build-python.sh --- build-python.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/build-python.sh b/build-python.sh index d312c5edaca4..2aaae32140bc 100755 --- a/build-python.sh +++ b/build-python.sh @@ -348,17 +348,13 @@ fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true - # echo "${BUILD_ARGS}" \ - # | xargs \ - # python -m build \ - # --wheel \ - # --outdir ../dist \ - # . - python -m build \ - --wheel \ - --outdir ../dist \ - ${BUILD_ARGS} \ - . + echo "${BUILD_ARGS}" + echo "${BUILD_ARGS}" \ + | xargs \ + python -m build \ + --wheel \ + --outdir ../dist \ + . fi if test "${INSTALL}" = true; then From c9f8483c32ef46a41ef7ac0400400dc8c4eb89d6 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 04:42:35 +0300 Subject: [PATCH 082/112] Update build-python.sh --- build-python.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build-python.sh b/build-python.sh index 2aaae32140bc..f89fd075274b 100755 --- a/build-python.sh +++ b/build-python.sh @@ -347,8 +347,7 @@ fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" - rm -f ../dist/*.whl || true - echo "${BUILD_ARGS}" + rm -f ../dist/*.whl echo "${BUILD_ARGS}" \ | xargs \ python -m build \ From 532121f66b40afdea8f2f803d5e1a4296ad4c3de Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 05:08:57 +0300 Subject: [PATCH 083/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index f89fd075274b..7f4bfcff81a8 100755 --- a/build-python.sh +++ b/build-python.sh @@ -347,7 +347,7 @@ fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" - rm -f ../dist/*.whl + rm -f ../dist/*.whl || true echo "${BUILD_ARGS}" \ | xargs \ python -m build \ From f4fc100aa3b4bda2f7128259b56bd9be28292ea7 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 05:59:52 +0300 Subject: [PATCH 084/112] Update build-python.sh --- build-python.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/build-python.sh b/build-python.sh index 7f4bfcff81a8..ccef66ab3d96 100755 --- a/build-python.sh +++ b/build-python.sh @@ -70,7 +70,8 @@ BUILD_SDIST="false" BUILD_WHEEL="false" PIP_INSTALL_ARGS="" -BUILD_ARGS="" +INITIAL_BUILD_ARGS="--outdir ../dist ." +BUILD_ARGS="${INITIAL_BUILD_ARGS}" PRECOMPILE="false" while [ $# -gt 0 ]; do @@ -294,7 +295,7 @@ if test "${INSTALL}" = true; then if test "${PRECOMPILE}" = true; then BUILD_SDIST=true BUILD_WHEEL=false - BUILD_ARGS="" + BUILD_ARGS="${INITIAL_BUILD_ARGS}" rm -rf \ ./cmake \ ./CMakeLists.txt \ @@ -340,9 +341,7 @@ if test "${BUILD_SDIST}" = true; then echo "${BUILD_ARGS}" \ | xargs \ python -m build \ - --sdist \ - --outdir ../dist \ - . + --sdist fi if test "${BUILD_WHEEL}" = true; then @@ -351,9 +350,7 @@ if test "${BUILD_WHEEL}" = true; then echo "${BUILD_ARGS}" \ | xargs \ python -m build \ - --wheel \ - --outdir ../dist \ - . + --wheel fi if test "${INSTALL}" = true; then From 652ada11b6b441503ff8ba13459e8d452e96392d Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 06:11:58 +0300 Subject: [PATCH 085/112] Update build-python.sh --- build-python.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-python.sh b/build-python.sh index ccef66ab3d96..82c42482123f 100755 --- a/build-python.sh +++ b/build-python.sh @@ -70,6 +70,8 @@ BUILD_SDIST="false" BUILD_WHEEL="false" PIP_INSTALL_ARGS="" +# cannot be empty to overcome the problem of passing empty string to xargs +# ref: https://stackoverflow.com/a/8296746 INITIAL_BUILD_ARGS="--outdir ../dist ." BUILD_ARGS="${INITIAL_BUILD_ARGS}" PRECOMPILE="false" @@ -338,6 +340,7 @@ fi if test "${BUILD_SDIST}" = true; then echo "--- building sdist ---" rm -f ../dist/*.tar.gz + # use xargs to work with args that contain whitespaces echo "${BUILD_ARGS}" \ | xargs \ python -m build \ @@ -347,6 +350,7 @@ fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true + # use xargs to work with args that contain whitespaces echo "${BUILD_ARGS}" \ | xargs \ python -m build \ From b467e78a50b948a6e005ca9a4387d34f37ee7c7a Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 07:10:40 +0300 Subject: [PATCH 086/112] Update README.rst --- python-package/README.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python-package/README.rst b/python-package/README.rst index 54a55fc01daf..77fda5c0d32e 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -208,6 +208,10 @@ Build 32-bit Version with 32-bit Python pip install lightgbm --no-binary lightgbm --config-settings=cmake.args="-GVisual Studio 17 2022" --config-settings=cmake.args="-AWin32" +For **Windows** users, compilation with **MinGW-w64** is not supported. + +For **macOS** and **Linux** users, the 32-bit version is not supported. + It is **strongly not recommended** to use this version of LightGBM! | From f7226345742420c619109c51348aac5e0fa913ce Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 07:11:44 +0300 Subject: [PATCH 087/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index 77fda5c0d32e..73cb0d1c4403 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -206,7 +206,7 @@ Build 32-bit Version with 32-bit Python .. code:: sh - pip install lightgbm --no-binary lightgbm --config-settings=cmake.args="-GVisual Studio 17 2022" --config-settings=cmake.args="-AWin32" + pip install lightgbm --no-binary lightgbm --config-settings=cmake.args="-AWin32" For **Windows** users, compilation with **MinGW-w64** is not supported. From 0a858fe9a9ecdea381fe9d0751ef3cec652b4a53 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 07:14:52 +0300 Subject: [PATCH 088/112] Update build-python.sh --- build-python.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build-python.sh b/build-python.sh index 82c42482123f..b18280464a10 100755 --- a/build-python.sh +++ b/build-python.sh @@ -139,9 +139,8 @@ while [ $# -gt 0 ]; do # flags # ######### --bit32) - export CMAKE_GENERATOR="Visual Studio 17 2022" - export CMAKE_GENERATOR_PLATFORM="Win32" - echo "[INFO] Attempting to build 32-bit version of LightGBM, which is only supported on Windows with generator '${CMAKE_GENERATOR}'." + echo "[INFO] Attempting to build 32-bit version of LightGBM, which is only supported on Windows with Visual Studio." + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.args=-AWin32" ;; --cuda) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_CUDA=ON" From a212e1aa90e7efa69266c03b3cdc098c074211bb Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 08:00:47 +0300 Subject: [PATCH 089/112] Update README.rst --- python-package/README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-package/README.rst b/python-package/README.rst index 73cb0d1c4403..772e48283d8d 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -305,6 +305,8 @@ Run ``sh ./build-python.sh install --mingw``, if you want to use **MinGW-w64** o Run ``sh ./build-python.sh install --bit32``, if you want to use 32-bit version. All requirements from `Build 32-bit Version with 32-bit Python section <#build-32-bit-version-with-32-bit-python>`__ apply for this installation option as well. +Run ``sh ./build-python.sh install --nohomebrew``, if you want to stop looking into Homebrew standard folders. All requirements from `Build without Searching in Homebrew Folders for Dependencies on macOS section <#build-without-searching-in-homebrew-folders-for-dependencies-on-macos>`__ apply for this installation option as well. + Run ``sh ./build-python.sh install --time-costs``, if you want to output time costs for different internal routines. All requirements from `Build with Time Costs Output section <#build-with-time-costs-output>`__ apply for this installation option as well. If you get any errors during installation or due to any other reasons, you may want to build dynamic library from sources by any method you prefer (see `Installation Guide `__) and then just run ``sh ./build-python.sh install --precompile``. From 92db16e96adffe5bda3e18a92c043f3736f442f6 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 08:01:53 +0300 Subject: [PATCH 090/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index 772e48283d8d..fef8922a37d3 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -305,7 +305,7 @@ Run ``sh ./build-python.sh install --mingw``, if you want to use **MinGW-w64** o Run ``sh ./build-python.sh install --bit32``, if you want to use 32-bit version. All requirements from `Build 32-bit Version with 32-bit Python section <#build-32-bit-version-with-32-bit-python>`__ apply for this installation option as well. -Run ``sh ./build-python.sh install --nohomebrew``, if you want to stop looking into Homebrew standard folders. All requirements from `Build without Searching in Homebrew Folders for Dependencies on macOS section <#build-without-searching-in-homebrew-folders-for-dependencies-on-macos>`__ apply for this installation option as well. +Run ``sh ./build-python.sh install --nohomebrew``, if you want to ignore Homebrew standard folders. All requirements from `Build without Searching in Homebrew Folders for Dependencies on macOS section <#build-without-searching-in-homebrew-folders-for-dependencies-on-macos>`__ apply for this installation option as well. Run ``sh ./build-python.sh install --time-costs``, if you want to output time costs for different internal routines. All requirements from `Build with Time Costs Output section <#build-with-time-costs-output>`__ apply for this installation option as well. From 7a80b77406d41ff1dd657cbe3a168a00c9863b28 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Wed, 25 Dec 2024 08:08:05 +0300 Subject: [PATCH 091/112] Update build-python.sh --- build-python.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index b18280464a10..733f09f01173 100755 --- a/build-python.sh +++ b/build-python.sh @@ -49,13 +49,15 @@ # --no-isolation # Assume all build and install dependencies are already installed, # don't go to the internet to get them. +# --nohomebrew +# Compile version ignoring Homebrew standard folders for finding dependencies. # --nomp # Compile version without OpenMP support. # --precompile # Use precompiled library. # Only used with 'install' command. # --time-costs -# Output time costs for different internal routines. +# Compile version that outputs time costs for different internal routines. # --user # Install into user-specific instead of global site-packages directory. # Only used with 'install' command. @@ -162,6 +164,9 @@ while [ $# -gt 0 ]; do BUILD_ARGS="${BUILD_ARGS} --no-isolation" PIP_INSTALL_ARGS="${PIP_INSTALL_ARGS} --no-build-isolation" ;; + --nohomebrew) + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_HOMEBREW_FALLBACK=OFF" + ;; --nomp) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_OPENMP=OFF" ;; From 078481d6e1563bff91bcd5a9659bfeb42b0886c2 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 03:52:33 +0300 Subject: [PATCH 092/112] Update build-python.sh --- build-python.sh | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/build-python.sh b/build-python.sh index 733f09f01173..ac5281c8d724 100755 --- a/build-python.sh +++ b/build-python.sh @@ -72,10 +72,7 @@ BUILD_SDIST="false" BUILD_WHEEL="false" PIP_INSTALL_ARGS="" -# cannot be empty to overcome the problem of passing empty string to xargs -# ref: https://stackoverflow.com/a/8296746 -INITIAL_BUILD_ARGS="--outdir ../dist ." -BUILD_ARGS="${INITIAL_BUILD_ARGS}" +BUILD_ARGS="" PRECOMPILE="false" while [ $# -gt 0 ]; do @@ -301,7 +298,7 @@ if test "${INSTALL}" = true; then if test "${PRECOMPILE}" = true; then BUILD_SDIST=true BUILD_WHEEL=false - BUILD_ARGS="${INITIAL_BUILD_ARGS}" + BUILD_ARGS="" rm -rf \ ./cmake \ ./CMakeLists.txt \ @@ -345,20 +342,17 @@ if test "${BUILD_SDIST}" = true; then echo "--- building sdist ---" rm -f ../dist/*.tar.gz # use xargs to work with args that contain whitespaces - echo "${BUILD_ARGS}" \ - | xargs \ - python -m build \ - --sdist + # note that empty echo string leads to that xargs doesn't run the command + # in some xargs implementations + # ref: https://stackoverflow.com/a/8296746 + echo "--sdist --outdir ../dist ${BUILD_ARGS} ." | xargs python -m build fi if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true # use xargs to work with args that contain whitespaces - echo "${BUILD_ARGS}" \ - | xargs \ - python -m build \ - --wheel + echo "--wheel --outdir ../dist ${BUILD_ARGS} ." | xargs python -m build fi if test "${INSTALL}" = true; then From 08a98a3ab0bb384a82f3db3f2b63bda1ee7ebd6a Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 03:54:20 +0300 Subject: [PATCH 093/112] Update build-python.sh --- build-python.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index ac5281c8d724..8b8a7d9d022a 100755 --- a/build-python.sh +++ b/build-python.sh @@ -343,7 +343,7 @@ if test "${BUILD_SDIST}" = true; then rm -f ../dist/*.tar.gz # use xargs to work with args that contain whitespaces # note that empty echo string leads to that xargs doesn't run the command - # in some xargs implementations + # in some implementations of xargs # ref: https://stackoverflow.com/a/8296746 echo "--sdist --outdir ../dist ${BUILD_ARGS} ." | xargs python -m build fi @@ -352,6 +352,9 @@ if test "${BUILD_WHEEL}" = true; then echo "--- building wheel ---" rm -f ../dist/*.whl || true # use xargs to work with args that contain whitespaces + # note that empty echo string leads to that xargs doesn't run the command + # in some implementations of xargs + # ref: https://stackoverflow.com/a/8296746 echo "--wheel --outdir ../dist ${BUILD_ARGS} ." | xargs python -m build fi From fb27330855e86b798d208c796701ebe02030ad81 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 05:12:58 +0300 Subject: [PATCH 094/112] Update README.rst --- python-package/README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-package/README.rst b/python-package/README.rst index fef8922a37d3..93952d50fc3a 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -309,6 +309,8 @@ Run ``sh ./build-python.sh install --nohomebrew``, if you want to ignore Homebre Run ``sh ./build-python.sh install --time-costs``, if you want to output time costs for different internal routines. All requirements from `Build with Time Costs Output section <#build-with-time-costs-output>`__ apply for this installation option as well. +Run ``sh ./build-python.sh install --debug``, to enable debug mode. All requirements from `Build in Debug Mode section <#build-in-debug-mode>`__ apply for this installation option as well. + If you get any errors during installation or due to any other reasons, you may want to build dynamic library from sources by any method you prefer (see `Installation Guide `__) and then just run ``sh ./build-python.sh install --precompile``. Build Wheel File From 1e7e2ef96ae99fb86e7dc71d26994ff17382e08a Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 05:16:28 +0300 Subject: [PATCH 095/112] Update build-python.sh --- build-python.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build-python.sh b/build-python.sh index 8b8a7d9d022a..3ed6f5e0106a 100755 --- a/build-python.sh +++ b/build-python.sh @@ -38,6 +38,8 @@ # Compile 32-bit version. # --cuda # Compile CUDA version. +# --debug +# Compile version with debug mode. # --gpu # Compile GPU version. # --integrated-opencl @@ -144,6 +146,9 @@ while [ $# -gt 0 ]; do --cuda) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_CUDA=ON" ;; + --debug) + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_DEBUG=ON" + ;; --gpu) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_GPU=ON" ;; From 0d055adedcc2e8d76b9f27170f4fb525584d12b7 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 05:17:46 +0300 Subject: [PATCH 096/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 3ed6f5e0106a..96f3dea2f4c2 100755 --- a/build-python.sh +++ b/build-python.sh @@ -39,7 +39,7 @@ # --cuda # Compile CUDA version. # --debug -# Compile version with debug mode. +# Compile in debug mode. # --gpu # Compile GPU version. # --integrated-opencl From 7a3ba7fe84ffccf79abd559499f2b548c2ad01a7 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 05:28:08 +0300 Subject: [PATCH 097/112] Update build-python.sh --- build-python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-python.sh b/build-python.sh index 96f3dea2f4c2..06217066617b 100755 --- a/build-python.sh +++ b/build-python.sh @@ -147,7 +147,7 @@ while [ $# -gt 0 ]; do BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_CUDA=ON" ;; --debug) - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_DEBUG=ON" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_DEBUG=ON --config-setting=cmake.build-type=Debug" ;; --gpu) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_GPU=ON" From c13aa464c80703a751269ce499bec6ffecff61af Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 05:39:39 +0300 Subject: [PATCH 098/112] Update README.rst --- python-package/README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-package/README.rst b/python-package/README.rst index 93952d50fc3a..6287b4e09e5c 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -311,6 +311,8 @@ Run ``sh ./build-python.sh install --time-costs``, if you want to output time co Run ``sh ./build-python.sh install --debug``, to enable debug mode. All requirements from `Build in Debug Mode section <#build-in-debug-mode>`__ apply for this installation option as well. +Run ``sh ./build-python.sh install --sanitizers="address;leak;undefined"``, to enable sanitizers. All requirements from `Build with Sanitizers section <#build-with-sanitizers>`__ apply for this installation option as well. + If you get any errors during installation or due to any other reasons, you may want to build dynamic library from sources by any method you prefer (see `Installation Guide `__) and then just run ``sh ./build-python.sh install --precompile``. Build Wheel File From 2a857841b542d66290c4842df4853b525307f3ef Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 05:50:08 +0300 Subject: [PATCH 099/112] Update build-python.sh --- build-python.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/build-python.sh b/build-python.sh index 06217066617b..e7be7eb6b323 100755 --- a/build-python.sh +++ b/build-python.sh @@ -34,6 +34,8 @@ # OpenCL include directory. # --opencl-library=FILEPATH # Path to OpenCL library. +# --sanitizers=LIST_OF_SANITIZERS +# Semicolon separated list with chosen compiler sanitizers. # --bit32 # Compile 32-bit version. # --cuda @@ -136,6 +138,14 @@ while [ $# -gt 0 ]; do OPENCL_LIBRARY="${1#*=}" BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.OpenCL_LIBRARY='${OPENCL_LIBRARY}'" ;; + --sanitizers|--sanitizers=*) + if echo "$1" | grep -q '^*=*$'; + then shift; + fi + SANITIZERS="${1#*=}" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_SANITIZER=ON" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.ENABLED_SANITIZERS='${SANITIZERS}'" + ;; ######### # flags # ######### @@ -147,7 +157,8 @@ while [ $# -gt 0 ]; do BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_CUDA=ON" ;; --debug) - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_DEBUG=ON --config-setting=cmake.build-type=Debug" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_DEBUG=ON" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.build-type=Debug" ;; --gpu) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_GPU=ON" @@ -157,7 +168,8 @@ while [ $# -gt 0 ]; do ;; --mingw) # ref: https://stackoverflow.com/a/45104058/3986677 - BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND --config-setting=cmake.args=-G'MinGW Makefiles'" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.CMAKE_SH=CMAKE_SH-NOTFOUND" + BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.args=-G'MinGW Makefiles'" ;; --mpi) BUILD_ARGS="${BUILD_ARGS} --config-setting=cmake.define.USE_MPI=ON" From 0736db24f9c22d1b273268ea9c991d336891600f Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 05:51:20 +0300 Subject: [PATCH 100/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index 6287b4e09e5c..464ba41670f3 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -311,7 +311,7 @@ Run ``sh ./build-python.sh install --time-costs``, if you want to output time co Run ``sh ./build-python.sh install --debug``, to enable debug mode. All requirements from `Build in Debug Mode section <#build-in-debug-mode>`__ apply for this installation option as well. -Run ``sh ./build-python.sh install --sanitizers="address;leak;undefined"``, to enable sanitizers. All requirements from `Build with Sanitizers section <#build-with-sanitizers>`__ apply for this installation option as well. +Run ``sh ./build-python.sh install --sanitizers="address;leak;undefined"``, to enable compiler sanitizers. All requirements from `Build with Sanitizers section <#build-with-sanitizers>`__ apply for this installation option as well. If you get any errors during installation or due to any other reasons, you may want to build dynamic library from sources by any method you prefer (see `Installation Guide `__) and then just run ``sh ./build-python.sh install --precompile``. From f0a541f64002ed2f6ec45910a490ea4c90f778ff Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 06:31:26 +0300 Subject: [PATCH 101/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index 464ba41670f3..99ea62005947 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -313,7 +313,7 @@ Run ``sh ./build-python.sh install --debug``, to enable debug mode. All requirem Run ``sh ./build-python.sh install --sanitizers="address;leak;undefined"``, to enable compiler sanitizers. All requirements from `Build with Sanitizers section <#build-with-sanitizers>`__ apply for this installation option as well. -If you get any errors during installation or due to any other reasons, you may want to build dynamic library from sources by any method you prefer (see `Installation Guide `__) and then just run ``sh ./build-python.sh install --precompile``. +If you get any errors during installation or due to any other reasons, you may want to build dynamic library from sources by any method you prefer (see `Installation Guide `__), for example, with ``MSBuild`` tool and `solution file `__. After compiling dynamic library just run ``sh ./build-python.sh install --precompile``. Build Wheel File **************** From 722f9288de91b532d72b332e7c7d072f0fa51199 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 06:41:29 +0300 Subject: [PATCH 102/112] Update README.rst --- python-package/README.rst | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/python-package/README.rst b/python-package/README.rst index 99ea62005947..e00884af9ecf 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -313,7 +313,13 @@ Run ``sh ./build-python.sh install --debug``, to enable debug mode. All requirem Run ``sh ./build-python.sh install --sanitizers="address;leak;undefined"``, to enable compiler sanitizers. All requirements from `Build with Sanitizers section <#build-with-sanitizers>`__ apply for this installation option as well. -If you get any errors during installation or due to any other reasons, you may want to build dynamic library from sources by any method you prefer (see `Installation Guide `__), for example, with ``MSBuild`` tool and `solution file `__. After compiling dynamic library just run ``sh ./build-python.sh install --precompile``. +If you get any errors during installation or due to any other reasons, you may want to build dynamic library from sources by any method you prefer (see `Installation Guide `__). For example, you can use ``MSBuild`` tool and `solution file `__ from the repo. + +.. code:: sh + + MSBuild.exe windows/LightGBM.sln /p:Configuration=DLL /p:Platform=x64 /p:PlatformToolset=v143 + +After compiling dynamic library just run ``sh ./build-python.sh install --precompile``. Build Wheel File **************** @@ -327,21 +333,6 @@ In environments with restricted or no internet access, install those tools and t sh ./build-python.sh bdist_wheel --no-isolation -Build With MSBuild -****************** - -To use ``MSBuild`` (Windows-only), first build ``lib_lightgbm.dll`` by running the following from the root of the repo. - -.. code:: sh - - MSBuild.exe windows/LightGBM.sln /p:Configuration=DLL /p:Platform=x64 /p:PlatformToolset=v143 - -Then install the Python-package using that library. - -.. code:: sh - - sh ./build-python.sh install --precompile - Troubleshooting --------------- From 56cc500c02bfca96114fe57d1525e5d3701a0ff1 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 06:57:04 +0300 Subject: [PATCH 103/112] Update build-python.sh --- build-python.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build-python.sh b/build-python.sh index e7be7eb6b323..3b5c07b2967c 100755 --- a/build-python.sh +++ b/build-python.sh @@ -340,6 +340,9 @@ if test "${INSTALL}" = true; then elif test -f ../lib_lightgbm.dylib; then echo "found pre-compiled lib_lightgbm.dylib" cp ../lib_lightgbm.dylib ./lightgbm/lib/lib_lightgbm.dylib + elif test -f ../lib_lightgbm.dll; then + echo "found pre-compiled lib_lightgbm.dll" + cp ../lib_lightgbm.dll ./lightgbm/lib/lib_lightgbm.dll elif test -f ../Release/lib_lightgbm.dll; then echo "found pre-compiled Release/lib_lightgbm.dll" cp ../Release/lib_lightgbm.dll ./lightgbm/lib/lib_lightgbm.dll From da0ebc9fce31f6409d47eee0c8ad0d391982c977 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 07:05:02 +0300 Subject: [PATCH 104/112] Update build-python.sh --- build-python.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-python.sh b/build-python.sh index 3b5c07b2967c..ccd1a41a15c3 100755 --- a/build-python.sh +++ b/build-python.sh @@ -350,6 +350,10 @@ if test "${INSTALL}" = true; then echo "found pre-compiled windows/x64/DLL/lib_lightgbm.dll" cp ../windows/x64/DLL/lib_lightgbm.dll ./lightgbm/lib/lib_lightgbm.dll cp ../windows/x64/DLL/lib_lightgbm.lib ./lightgbm/lib/lib_lightgbm.lib + elif test -f ../windows/x64/Debug_DLL/lib_lightgbm.dll; then + echo "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 fi rm -f ./*.bak else From ace2590aa825e6c70738b91b0bc647f83ed5ef26 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 07:11:57 +0300 Subject: [PATCH 105/112] Update build-python.sh --- build-python.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build-python.sh b/build-python.sh index ccd1a41a15c3..e9992587fdb3 100755 --- a/build-python.sh +++ b/build-python.sh @@ -354,6 +354,9 @@ if test "${INSTALL}" = true; then echo "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 + else + echo "cannot find pre-compiled library. Aborting" + exit 1 fi rm -f ./*.bak else From c38187cd3d3c4bb90748f8573da1dbcee4b8e359 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 07:18:59 +0300 Subject: [PATCH 106/112] Update build-python.sh --- build-python.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/build-python.sh b/build-python.sh index e9992587fdb3..87032bc362c4 100755 --- a/build-python.sh +++ b/build-python.sh @@ -68,7 +68,7 @@ set -e -u -echo "building lightgbm" +echo "[INFO] building lightgbm" # Default values of arguments INSTALL="false" @@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do PIP_INSTALL_ARGS="${PIP_INSTALL_ARGS} --user" ;; *) - echo "invalid argument '${1}'" + echo "[ERROR] invalid argument '${1}'. Aborting" exit 1 ;; esac @@ -335,27 +335,27 @@ if test "${INSTALL}" = true; then echo "" >> ./MANIFEST.in mkdir -p ./lightgbm/lib if test -f ../lib_lightgbm.so; then - echo "found pre-compiled lib_lightgbm.so" + echo "[INFO] found pre-compiled lib_lightgbm.so" cp ../lib_lightgbm.so ./lightgbm/lib/lib_lightgbm.so elif test -f ../lib_lightgbm.dylib; then - echo "found pre-compiled lib_lightgbm.dylib" + echo "[INFO] found pre-compiled lib_lightgbm.dylib" cp ../lib_lightgbm.dylib ./lightgbm/lib/lib_lightgbm.dylib elif test -f ../lib_lightgbm.dll; then - echo "found pre-compiled lib_lightgbm.dll" + echo "[INFO] found pre-compiled lib_lightgbm.dll" cp ../lib_lightgbm.dll ./lightgbm/lib/lib_lightgbm.dll elif test -f ../Release/lib_lightgbm.dll; then - echo "found pre-compiled Release/lib_lightgbm.dll" + echo "[INFO] found pre-compiled Release/lib_lightgbm.dll" cp ../Release/lib_lightgbm.dll ./lightgbm/lib/lib_lightgbm.dll elif test -f ../windows/x64/DLL/lib_lightgbm.dll; then - echo "found pre-compiled windows/x64/DLL/lib_lightgbm.dll" + echo "[INFO] found pre-compiled windows/x64/DLL/lib_lightgbm.dll" cp ../windows/x64/DLL/lib_lightgbm.dll ./lightgbm/lib/lib_lightgbm.dll cp ../windows/x64/DLL/lib_lightgbm.lib ./lightgbm/lib/lib_lightgbm.lib elif test -f ../windows/x64/Debug_DLL/lib_lightgbm.dll; then - echo "found pre-compiled windows/x64/Debug_DLL/lib_lightgbm.dll" + 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 else - echo "cannot find pre-compiled library. Aborting" + echo "[ERROR] cannot find pre-compiled library. Aborting" exit 1 fi rm -f ./*.bak @@ -366,7 +366,7 @@ if test "${INSTALL}" = true; then fi if test "${BUILD_SDIST}" = true; then - echo "--- building sdist ---" + echo "[INFO] --- building sdist ---" rm -f ../dist/*.tar.gz # use xargs to work with args that contain whitespaces # note that empty echo string leads to that xargs doesn't run the command @@ -376,7 +376,7 @@ if test "${BUILD_SDIST}" = true; then fi if test "${BUILD_WHEEL}" = true; then - echo "--- building wheel ---" + echo "[INFO] --- building wheel ---" rm -f ../dist/*.whl || true # use xargs to work with args that contain whitespaces # note that empty echo string leads to that xargs doesn't run the command @@ -386,7 +386,7 @@ if test "${BUILD_WHEEL}" = true; then fi if test "${INSTALL}" = true; then - echo "--- installing lightgbm ---" + echo "[INFO] --- installing lightgbm ---" cd ../dist if test "${BUILD_WHEEL}" = true; then PACKAGE_NAME="$(echo lightgbm*.whl)" @@ -405,5 +405,5 @@ if test "${INSTALL}" = true; then cd ../ fi -echo "cleaning up" +echo "[INFO] cleaning up" rm -rf ./lightgbm-python From ed4c45328fec1f1994be034d5ff84d0848d09358 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 07:20:29 +0300 Subject: [PATCH 107/112] Update LightGBM.vcxproj --- windows/LightGBM.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/LightGBM.vcxproj b/windows/LightGBM.vcxproj index bb4818572ac0..cd88c05067f4 100644 --- a/windows/LightGBM.vcxproj +++ b/windows/LightGBM.vcxproj @@ -34,7 +34,7 @@ SAK SAK LightGBM - 10.0 + 8.1 From 599561addec47fb393ba9a12e24cc4ac37c8f1c2 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 07:31:50 +0300 Subject: [PATCH 108/112] Update LightGBM.vcxproj --- windows/LightGBM.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/LightGBM.vcxproj b/windows/LightGBM.vcxproj index cd88c05067f4..bb4818572ac0 100644 --- a/windows/LightGBM.vcxproj +++ b/windows/LightGBM.vcxproj @@ -34,7 +34,7 @@ SAK SAK LightGBM - 8.1 + 10.0 From 0247c6b519d0cc78af5b3138fb7b785ace6d61bf Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 07:33:23 +0300 Subject: [PATCH 109/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index e00884af9ecf..79f43a5682db 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -319,7 +319,7 @@ If you get any errors during installation or due to any other reasons, you may w MSBuild.exe windows/LightGBM.sln /p:Configuration=DLL /p:Platform=x64 /p:PlatformToolset=v143 -After compiling dynamic library just run ``sh ./build-python.sh install --precompile``. +After compiling dynamic library just run ``sh ./build-python.sh install --precompile`` to install the Python-package using that library. Build Wheel File **************** From dd1a94a66ec7c37dcc83c27de3bf58e910fae9fe Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 07:36:24 +0300 Subject: [PATCH 110/112] Update README.rst --- python-package/README.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python-package/README.rst b/python-package/README.rst index 79f43a5682db..651258d0dd74 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -293,6 +293,8 @@ All requirements from `Build from Sources section <#build-from-sources>`__ apply Note: ``sudo`` (or administrator rights in **Windows**) may be needed to perform the command. +| + 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. @@ -313,6 +315,8 @@ Run ``sh ./build-python.sh install --debug``, to enable debug mode. All requirem Run ``sh ./build-python.sh install --sanitizers="address;leak;undefined"``, to enable compiler sanitizers. All requirements from `Build with Sanitizers section <#build-with-sanitizers>`__ apply for this installation option as well. +| + If you get any errors during installation or due to any other reasons, you may want to build dynamic library from sources by any method you prefer (see `Installation Guide `__). For example, you can use ``MSBuild`` tool and `solution file `__ from the repo. .. code:: sh @@ -321,6 +325,8 @@ If you get any errors during installation or due to any other reasons, you may w After compiling dynamic library just run ``sh ./build-python.sh install --precompile`` to install the Python-package using that library. +| + Build Wheel File **************** From 136790286a03931ad03e89ebdd2c9dad28df678e Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 07:37:20 +0300 Subject: [PATCH 111/112] Update README.rst --- python-package/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/README.rst b/python-package/README.rst index 651258d0dd74..8983b804ca01 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -330,7 +330,7 @@ After compiling dynamic library just run ``sh ./build-python.sh install --precom Build Wheel File **************** -You can use ``sh ./build-python.sh bdist_wheel`` to build a wheel file but not install it. +You can run ``sh ./build-python.sh bdist_wheel`` to build a wheel file but not install it. That script requires some dependencies like ``build``, ``scikit-build-core``, and ``wheel``. In environments with restricted or no internet access, install those tools and then pass ``--no-isolation``. From bb39ff5ee26f9ffe0bbac22f6cac55dd6a85b072 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 26 Dec 2024 08:18:39 +0300 Subject: [PATCH 112/112] Update README.rst --- python-package/README.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python-package/README.rst b/python-package/README.rst index 8983b804ca01..6beaacd5d68b 100644 --- a/python-package/README.rst +++ b/python-package/README.rst @@ -292,6 +292,9 @@ All requirements from `Build from Sources section <#build-from-sources>`__ apply sh ./build-python.sh install Note: ``sudo`` (or administrator rights in **Windows**) may be needed to perform the command. +Run ``sh ./build-python.sh install --user`` to install into user-specific instead of global site-packages directory. + +Run ``sh ./build-python.sh install --no-isolation`` to assume all build and install dependencies are already installed, don't go to the internet to get them. |