1{ buildPythonPackage, fetchFromGitHub, lib, pythonOlder
2, clang_12, python2, python
3, graphviz, matplotlib, numpy, pandas, plotly, scipy, six
4, withCuda ? false, cudatoolkit }:
5
6buildPythonPackage rec {
7 pname = "catboost";
8 version = "1.0.5";
9
10 disabled = pythonOlder "3.4";
11
12 src = fetchFromGitHub {
13 owner = "catboost";
14 repo = "catboost";
15 rev = "v${version}";
16 sha256 = "ILemeZUBI9jPb9G6F7QX/T1HaVhQ+g6y7YmsT6DFCJk=";
17 };
18
19 nativeBuildInputs = [ clang_12 python2 ];
20
21 propagatedBuildInputs = [ graphviz matplotlib numpy pandas scipy plotly six ]
22 ++ lib.optionals withCuda [ cudatoolkit ];
23
24 patches = [
25 ./nix-support.patch
26 ];
27
28 postPatch = ''
29 # substituteInPlace is too slow for these large files, and the target has lots of numbers in it that change often.
30 sed -e 's|\$(YMAKE_PYTHON3-.*)/python3|${python.interpreter}|' -i make/*.makefile
31 '';
32
33 preBuild = ''
34 cd catboost/python-package
35 '';
36 setupPyBuildFlags = [ "--with-ymake=no" ];
37 CUDA_ROOT = lib.optional withCuda cudatoolkit;
38 enableParallelBuilding = true;
39
40 # Tests use custom "ya" tool, not yet supported.
41 dontUseSetuptoolsCheck = true;
42 pythonImportsCheck = [ "catboost" ];
43
44 meta = with lib; {
45 description = "High-performance library for gradient boosting on decision trees.";
46 longDescription = ''
47 A fast, scalable, high performance Gradient Boosting on Decision Trees
48 library, used for ranking, classification, regression and other machine
49 learning tasks for Python, R, Java, C++. Supports computation on CPU and GPU.
50 '';
51 license = licenses.asl20;
52 platforms = [ "x86_64-linux" ];
53 homepage = "https://catboost.ai";
54 maintainers = with maintainers; [ PlushBeaver ];
55 # _catboost.pyx.cpp:226822:19: error: use of undeclared identifier '_PyGen_Send'
56 broken = withCuda;
57 };
58}