Merge pull request #277681 from natsukium/lightgbm/update

python311Packages.lightgbm: 4.1.0 -> 4.2.0; fix build on linux
This commit is contained in:
OTABI Tomoya 2024-01-01 09:59:01 +09:00 committed by GitHub
commit 562570d8a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
{ lib { lib
, config
, stdenv , stdenv
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
@ -14,27 +15,37 @@
, llvmPackages , llvmPackages
, numpy , numpy
, scipy , scipy
, scikit-learn
, pythonOlder , pythonOlder
# optionals
, cffi
, dask
, pandas
, pyarrow
, scikit-learn
# optionals: gpu # optionals: gpu
, boost , boost
, cudatoolkit
, ocl-icd , ocl-icd
, opencl-headers , opencl-headers
, gpuSupport ? stdenv.isLinux , gpuSupport ? stdenv.isLinux && !cudaSupport
, cudaSupport ? config.cudaSupport
, cudaPackages
}: }:
assert gpuSupport -> cudaSupport != true;
assert cudaSupport -> gpuSupport != true;
buildPythonPackage rec { buildPythonPackage rec {
pname = "lightgbm"; pname = "lightgbm";
version = "4.1.0"; version = "4.2.0";
format = "pyproject"; pyproject = true;
disabled = pythonOlder "3.7"; disabled = pythonOlder "3.7";
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
hash = "sha256-vuWd0mmpOwk/LGENSmaDp+qHxj0+o1xiISPOLAILKrw="; hash = "sha256-ik0FHfKrIhiZihb3cS6EPunpbYsJ/7/MGFM9oSfg2gI=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
@ -43,6 +54,8 @@ buildPythonPackage rec {
pathspec pathspec
pyproject-metadata pyproject-metadata
scikit-build-core scikit-build-core
] ++ lib.optionals cudaSupport [
cudaPackages.cuda_nvcc
]; ];
dontUseCmakeConfigure = true; dontUseCmakeConfigure = true;
@ -51,23 +64,47 @@ buildPythonPackage rec {
llvmPackages.openmp llvmPackages.openmp
]) ++ (lib.optionals gpuSupport [ ]) ++ (lib.optionals gpuSupport [
boost boost
cudatoolkit
ocl-icd ocl-icd
opencl-headers opencl-headers
]); ]) ++ lib.optionals cudaSupport [
cudaPackages.cuda_nvcc
cudaPackages.cuda_cudart
];
propagatedBuildInputs = [ propagatedBuildInputs = [
numpy numpy
scipy scipy
scikit-learn
]; ];
pypaBuildFlags = lib.optionalString gpuSupport "--config-setting=cmake.define.USE_CUDA=ON"; pypaBuildFlags = lib.optionals gpuSupport [
"--config-setting=cmake.define.USE_GPU=ON"
] ++ lib.optionals cudaSupport [
"--config-setting=cmake.define.USE_CUDA=ON"
];
postConfigure = '' postConfigure = ''
export HOME=$(mktemp -d) export HOME=$(mktemp -d)
''; '';
passthru.optional-dependencies = {
arrow = [
cffi
pyarrow
];
dask = [
dask
pandas
] ++ dask.optional-dependencies.array
++ dask.optional-dependencies.dataframe
++ dask.optional-dependencies.distributed;
pandas = [
pandas
];
scikit-learn = [
scikit-learn
];
};
# The pypi package doesn't distribute the tests from the GitHub # The pypi package doesn't distribute the tests from the GitHub
# repository. It contains c++ tests which don't seem to wired up to # repository. It contains c++ tests which don't seem to wired up to
# `make check`. # `make check`.