1{ lib
2, buildPythonPackage
3, pythonOlder
4, cmake
5, numpy
6, scipy
7, stdenv
8, xgboost
9}:
10
11buildPythonPackage {
12 pname = "xgboost";
13 inherit (xgboost) version src meta;
14
15 disabled = pythonOlder "3.8";
16
17 nativeBuildInputs = [ cmake ];
18 buildInputs = [ xgboost ];
19 propagatedBuildInputs = [ numpy scipy ];
20
21 # Override existing logic for locating libxgboost.so which is not appropriate for Nix
22 prePatch = let
23 libPath = "${xgboost}/lib/libxgboost${stdenv.hostPlatform.extensions.sharedLibrary}";
24 in ''
25 echo 'find_lib_path = lambda: ["${libPath}"]' > python-package/xgboost/libpath.py
26 '';
27
28 dontUseCmakeConfigure = true;
29
30 postPatch = ''
31 cd python-package
32 '';
33
34 # test setup tries to download test data with no option to disable
35 # (removing sklearn from nativeCheckInputs causes all previously enabled tests to be skipped)
36 # and are extremely cpu intensive anyway
37 doCheck = false;
38
39 pythonImportsCheck = [
40 "xgboost"
41 ];
42
43 __darwinAllowLocalNetworking = true;
44}