2021-05-28 09:39:13 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2021-05-20 23:08:51 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, cmake
|
2020-04-24 23:36:52 +00:00
|
|
|
, scipy
|
2021-05-20 23:08:51 +00:00
|
|
|
, scikit-learn
|
2020-04-24 23:36:52 +00:00
|
|
|
, stdenv
|
|
|
|
, xgboost
|
|
|
|
, pandas
|
|
|
|
, matplotlib
|
|
|
|
, graphviz
|
|
|
|
, datatable
|
2021-05-20 23:08:51 +00:00
|
|
|
, hypothesis
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage {
|
|
|
|
pname = "xgboost";
|
|
|
|
inherit (xgboost) version src meta;
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = [ xgboost ];
|
|
|
|
propagatedBuildInputs = [ scipy ];
|
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
scikit-learn
|
|
|
|
pandas
|
|
|
|
matplotlib
|
|
|
|
graphviz
|
|
|
|
datatable
|
|
|
|
hypothesis
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
# Override existing logic for locating libxgboost.so which is not appropriate for Nix
|
|
|
|
prePatch = let
|
|
|
|
libPath = "${xgboost}/lib/libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
in ''
|
|
|
|
echo 'find_lib_path = lambda: ["${libPath}"]' > python-package/xgboost/libpath.py
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
dontUseCmakeConfigure = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
postPatch = ''
|
|
|
|
cd python-package
|
|
|
|
'';
|
|
|
|
|
|
|
|
preCheck = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
ln -sf ../demo .
|
2021-05-20 23:08:51 +00:00
|
|
|
ln -s ${xgboost}/bin/xgboost ../xgboost
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
# tests are extremely cpu intensive, only run basic tests to ensure package is working
|
|
|
|
pytestFlagsArray = ["../tests/python/test_basic.py"];
|
2021-05-20 23:08:51 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
# Requires internet access: https://github.com/dmlc/xgboost/blob/03cd087da180b7dff21bd8ef34997bf747016025/tests/python/test_ranking.py#L81
|
|
|
|
"../tests/python/test_ranking.py"
|
|
|
|
];
|
|
|
|
disabledTests = [
|
|
|
|
"test_cli_binary_classification"
|
|
|
|
"test_model_compatibility"
|
2021-05-28 09:39:13 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
# fails to connect to the com.apple.fonts daemon in sandboxed mode
|
|
|
|
"test_plotting"
|
|
|
|
"test_sklearn_plotting"
|
2021-05-20 23:08:51 +00:00
|
|
|
];
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|