[python312Packages.]lightgbm: 4.5.0 -> 4.6.0
Diff: https://github.com/microsoft/lightgbm/compare/v4.5.0...v4.6.0 Changelog: https://github.com/microsoft/LightGBM/releases/tag/v4.6.0
This commit is contained in:
parent
759641ba4c
commit
274e70aa39
@ -1,8 +1,9 @@
|
||||
{
|
||||
config,
|
||||
stdenv,
|
||||
lib,
|
||||
stdenv,
|
||||
config,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
cmake,
|
||||
gtest,
|
||||
doCheck ? true,
|
||||
@ -25,14 +26,14 @@
|
||||
R,
|
||||
rPackages,
|
||||
pandoc,
|
||||
python3Packages,
|
||||
}:
|
||||
|
||||
assert doCheck -> !mpiSupport;
|
||||
assert openclSupport -> !cudaSupport;
|
||||
assert cudaSupport -> !openclSupport;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pnameBase = "lightgbm";
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
# prefix with r when building the R library
|
||||
# The R package build results in a special binary file
|
||||
# that contains a subset of the .so file use for the CLI
|
||||
@ -45,17 +46,52 @@ stdenv.mkDerivation rec {
|
||||
# lgbm = lightgbm.override{rLibrary = true; doCheck = false;}; \
|
||||
# in \
|
||||
# rWrapper.override{ packages = [ lgbm ]; }"
|
||||
pname = lib.optionalString rLibrary "r-" + pnameBase;
|
||||
version = "4.5.0";
|
||||
pname = lib.optionalString rLibrary "r-" + "lightgbm";
|
||||
version = "4.6.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "microsoft";
|
||||
repo = pnameBase;
|
||||
rev = "v${version}";
|
||||
repo = "lightgbm";
|
||||
tag = "v${finalAttrs.version}";
|
||||
fetchSubmodules = true;
|
||||
hash = "sha256-nST6+/c3Y4/hqwgEUhx03gWtjxhlmUu1XKDCy2pSsvU=";
|
||||
hash = "sha256-vq/TlM87i1GNq0Rpy0OTulT9LF+uvi4PhOUz7ZNeceA=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Fix boost 1.83+ compatibility
|
||||
# https://github.com/microsoft/LightGBM/issues/6786
|
||||
# Patch taken from https://github.com/conda-forge/lightgbm-feedstock/pull/69
|
||||
(fetchpatch {
|
||||
name = "fix-boost-sha1";
|
||||
url = "https://raw.githubusercontent.com/conda-forge/lightgbm-feedstock/68ca96d25d8a6f7281310a4ad3b8d5cdd01f067b/recipe/patches/0003-boost-sha1.patch";
|
||||
hash = "sha256-Hw2YmoduOPri7O1XV2p/3Ny4hC8xq7Jq4zoSuKhVeVQ=";
|
||||
})
|
||||
];
|
||||
|
||||
# Skip APPLE in favor of linux build for .so files
|
||||
postPatch = ''
|
||||
export PROJECT_SOURCE_DIR=./
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace-fail "find_package(GTest CONFIG)" "find_package(GTest REQUIRED)" \
|
||||
--replace-fail "OpenCL_INCLUDE_DIRS}" "OpenCL_INCLUDE_DIRS}" \
|
||||
--replace-fail "elseif(APPLE)" "elseif(APPLESKIP)"
|
||||
substituteInPlace \
|
||||
external_libs/compute/include/boost/compute/cl.hpp \
|
||||
external_libs/compute/include/boost/compute/cl_ext.hpp \
|
||||
--replace-fail "include <OpenCL/" "include <CL/"
|
||||
substituteInPlace build_r.R \
|
||||
--replace-fail "shQuote(normalizePath" "shQuote(type = 'cmd', string = normalizePath" \
|
||||
--replace-fail "file.path(getwd(), \"lightgbm_r\")" "'$out/tmp'" \
|
||||
--replace-fail \
|
||||
"install_args <- c(\"CMD\", \"INSTALL\", \"--no-multiarch\", \"--with-keep.source\", tarball)" \
|
||||
"install_args <- c(\"CMD\", \"INSTALL\", \"--no-multiarch\", \"--with-keep.source\", \"-l $out/library\", tarball)"
|
||||
|
||||
# Retry this test in next release. Something fails in the setup, so GTEST_FILTER is not enough
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace-fail "tests/cpp_tests/test_arrow.cpp" ""
|
||||
rm tests/cpp_tests/test_arrow.cpp
|
||||
'';
|
||||
|
||||
nativeBuildInputs =
|
||||
[ cmake ]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [ llvmPackages.openmp ]
|
||||
@ -84,48 +120,36 @@ stdenv.mkDerivation rec {
|
||||
rPackages.R6
|
||||
];
|
||||
|
||||
# Skip APPLE in favor of linux build for .so files
|
||||
postPatch = ''
|
||||
export PROJECT_SOURCE_DIR=./
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace "find_package(GTest CONFIG)" "find_package(GTest REQUIRED)" \
|
||||
--replace "OpenCL_INCLUDE_DIRS}" "OpenCL_INCLUDE_DIRS}" \
|
||||
--replace "elseif(APPLE)" "elseif(APPLESKIP)"
|
||||
substituteInPlace \
|
||||
external_libs/compute/include/boost/compute/cl.hpp \
|
||||
external_libs/compute/include/boost/compute/cl_ext.hpp \
|
||||
--replace "include <OpenCL/" "include <CL/"
|
||||
substituteInPlace build_r.R \
|
||||
--replace "shQuote(normalizePath" "shQuote(type = 'cmd', string = normalizePath" \
|
||||
--replace "file.path(getwd(), \"lightgbm_r\")" "'$out/tmp'" \
|
||||
--replace \
|
||||
"install_args <- c(\"CMD\", \"INSTALL\", \"--no-multiarch\", \"--with-keep.source\", tarball)" \
|
||||
"install_args <- c(\"CMD\", \"INSTALL\", \"--no-multiarch\", \"--with-keep.source\", \"-l $out/library\", tarball)"
|
||||
|
||||
# Retry this test in next release. Something fails in the setup, so GTEST_FILTER is not enough
|
||||
rm tests/cpp_tests/test_arrow.cpp
|
||||
'';
|
||||
|
||||
cmakeFlags =
|
||||
lib.optionals doCheck [ "-DBUILD_CPP_TEST=ON" ]
|
||||
++ lib.optionals cudaSupport [
|
||||
"-DUSE_CUDA=1"
|
||||
"-DCMAKE_CXX_COMPILER=${cudaPackages.backendStdenv.cc}/bin/cc"
|
||||
lib.optionals doCheck [
|
||||
(lib.cmakeBool "BUILD_CPP_TEST" true)
|
||||
]
|
||||
++ lib.optionals cudaSupport [
|
||||
(lib.cmakeBool "USE_CUDA" true)
|
||||
(lib.cmakeFeature "CMAKE_CXX_COMPILER" (lib.getExe cudaPackages.backendStdenv.cc))
|
||||
]
|
||||
++ lib.optionals openclSupport [
|
||||
(lib.cmakeBool "USE_GPU" true)
|
||||
]
|
||||
++ lib.optionals mpiSupport [
|
||||
(lib.cmakeBool "USE_MPI" true)
|
||||
]
|
||||
++ lib.optionals openclSupport [ "-DUSE_GPU=ON" ]
|
||||
++ lib.optionals mpiSupport [ "-DUSE_MPI=ON" ]
|
||||
++ lib.optionals hdfsSupport [
|
||||
"-DUSE_HDFS=ON"
|
||||
"-DHDFS_LIB=${hadoop}/lib/hadoop-${hadoop.version}/lib/native/libhdfs.so"
|
||||
"-DHDFS_INCLUDE_DIR=${hadoop}/lib/hadoop-${hadoop.version}/include"
|
||||
(lib.cmakeBool "USE_HDFS" true)
|
||||
(lib.cmakeFeature "HDFS_LIB" "${hadoop}/lib/hadoop-${hadoop.version}/lib/native/libhdfs.so")
|
||||
(lib.cmakeFeature "HDFS_INCLUDE_DIR" "${hadoop}/lib/hadoop-${hadoop.version}/include")
|
||||
]
|
||||
++ lib.optionals javaWrapper [
|
||||
"-DUSE_SWIG=ON"
|
||||
(lib.cmakeBool "USE_SWIG" true)
|
||||
# RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
|
||||
"-DCMAKE_SKIP_BUILD_RPATH=ON"
|
||||
(lib.cmakeBool "CMAKE_SKIP_BUILD_RPATH" true)
|
||||
]
|
||||
++ lib.optionals rLibrary [ "-D__BUILD_FOR_R=ON" ]
|
||||
++ lib.optionals pythonLibrary [ "-D__BUILD_FOR_PYTHON=ON" ];
|
||||
++ lib.optionals rLibrary [
|
||||
(lib.cmakeBool "__BUILD_FOR_R" true)
|
||||
]
|
||||
++ lib.optionals pythonLibrary [
|
||||
(lib.cmakeBool "__BUILD_FOR_PYTHON" true)
|
||||
];
|
||||
|
||||
configurePhase = lib.optionals rLibrary ''
|
||||
export R_LIBS_SITE="$out/library:$R_LIBS_SITE''${R_LIBS_SITE:+:}"
|
||||
@ -182,16 +206,23 @@ stdenv.mkDerivation rec {
|
||||
|
||||
postFixup = lib.optionalString rLibrary ''
|
||||
if test -e $out/nix-support/propagated-build-inputs; then
|
||||
ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
|
||||
ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
|
||||
fi
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
passthru = {
|
||||
tests = {
|
||||
pythonPackage = python3Packages.lightgbm;
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "LightGBM is a gradient boosting framework that uses tree based learning algorithms.";
|
||||
mainProgram = "lightgbm";
|
||||
homepage = "https://github.com/microsoft/LightGBM";
|
||||
license = licenses.mit;
|
||||
platforms = platforms.unix;
|
||||
maintainers = with maintainers; [ nviets ];
|
||||
changelog = "https://github.com/microsoft/LightGBM/releases/tag/v${finalAttrs.version}";
|
||||
license = lib.licenses.mit;
|
||||
platforms = lib.platforms.unix;
|
||||
maintainers = with lib.maintainers; [ nviets ];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -2,23 +2,31 @@
|
||||
lib,
|
||||
config,
|
||||
stdenv,
|
||||
pkgs,
|
||||
buildPythonPackage,
|
||||
fetchPypi,
|
||||
|
||||
# build-system
|
||||
scikit-build-core,
|
||||
|
||||
# nativeBuildInputs
|
||||
cmake,
|
||||
ninja,
|
||||
pathspec,
|
||||
pyproject-metadata,
|
||||
scikit-build-core,
|
||||
writableTmpDirAsHomeHook,
|
||||
|
||||
# buildInputs
|
||||
llvmPackages,
|
||||
boost,
|
||||
ocl-icd,
|
||||
opencl-headers,
|
||||
|
||||
# dependencies
|
||||
llvmPackages,
|
||||
numpy,
|
||||
scipy,
|
||||
pythonOlder,
|
||||
|
||||
# optionals
|
||||
# optional-dependencies
|
||||
cffi,
|
||||
dask,
|
||||
pandas,
|
||||
@ -26,9 +34,6 @@
|
||||
scikit-learn,
|
||||
|
||||
# optionals: gpu
|
||||
boost,
|
||||
ocl-icd,
|
||||
opencl-headers,
|
||||
gpuSupport ? stdenv.hostPlatform.isLinux && !cudaSupport,
|
||||
cudaSupport ? config.cudaSupport,
|
||||
cudaPackages,
|
||||
@ -38,23 +43,28 @@ assert gpuSupport -> !cudaSupport;
|
||||
assert cudaSupport -> !gpuSupport;
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "lightgbm";
|
||||
version = "4.5.0";
|
||||
inherit (pkgs.lightgbm)
|
||||
pname
|
||||
version
|
||||
patches
|
||||
;
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.7";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-4c17rwMY1OMIomV1pjpGNfCN+GatNiKp2OPXHZY3obo=";
|
||||
hash = "sha256-yxxZcg61aTicC6dNFPUjUbVzr0ifIwAyocnzFPi6t/4=";
|
||||
};
|
||||
|
||||
build-system = [
|
||||
scikit-build-core
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
pathspec
|
||||
pyproject-metadata
|
||||
scikit-build-core
|
||||
writableTmpDirAsHomeHook
|
||||
] ++ lib.optionals cudaSupport [ cudaPackages.cuda_nvcc ];
|
||||
|
||||
dontUseCmakeConfigure = true;
|
||||
@ -71,7 +81,7 @@ buildPythonPackage rec {
|
||||
cudaPackages.cuda_cudart
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
dependencies = [
|
||||
numpy
|
||||
scipy
|
||||
];
|
||||
@ -80,10 +90,6 @@ buildPythonPackage rec {
|
||||
lib.optionals gpuSupport [ "--config-setting=cmake.define.USE_GPU=ON" ]
|
||||
++ lib.optionals cudaSupport [ "--config-setting=cmake.define.USE_CUDA=ON" ];
|
||||
|
||||
postConfigure = ''
|
||||
export HOME=$(mktemp -d)
|
||||
'';
|
||||
|
||||
optional-dependencies = {
|
||||
arrow = [
|
||||
cffi
|
||||
@ -101,9 +107,7 @@ buildPythonPackage rec {
|
||||
scikit-learn = [ scikit-learn ];
|
||||
};
|
||||
|
||||
# The pypi package doesn't distribute the tests from the GitHub
|
||||
# repository. It contains c++ tests which don't seem to wired up to
|
||||
# `make check`.
|
||||
# No python tests
|
||||
doCheck = false;
|
||||
|
||||
pythonImportsCheck = [ "lightgbm" ];
|
||||
|
Loading…
x
Reference in New Issue
Block a user