25 buildPythonPackage rec {
26 pname = "scikit-learn";
30 disabled = pythonOlder "3.9";
33 pname = "scikit_learn";
35 hash = "sha256-eJ49sBx1DtbUlvott9UGN4V7RR5XvK6GO/9wfBJHvvc=";
39 substituteInPlace pyproject.toml \
40 --replace-fail "numpy>=2.0.0rc2" "numpy"
42 substituteInPlace meson.build --replace-fail \
43 "run_command('sklearn/_build_utils/version.py', check: true).stdout().strip()," \
51 ] ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ];
76 env.LC_ALL = "en_US.UTF-8";
79 export SKLEARN_BUILD_PARALLEL=$NIX_BUILD_CORES
82 # PermissionError: [Errno 1] Operation not permitted: '/nix/nix-installer'
83 doCheck = !stdenv.hostPlatform.isDarwin;
86 # Skip test_feature_importance_regression - does web fetch
87 "test_feature_importance_regression"
88 ] ++ lib.optionals stdenv.hostPlatform.isAarch64 [
89 # doesn't seem to produce correct results?
90 # possibly relevant: https://github.com/scikit-learn/scikit-learn/issues/25838#issuecomment-2308650816
95 # verbose build outputs needed to debug hard-to-reproduce hydra failures
100 # NuSVC memmap tests causes segmentation faults in certain environments
101 # (e.g. Hydra Darwin machines) related to a long-standing joblib issue
102 # (https://github.com/joblib/joblib/issues/563). See also:
103 # https://github.com/scikit-learn/scikit-learn/issues/17582
104 # Since we are overriding '-k' we need to include the 'disabledTests' from above manually.
106 "'not (NuSVC and memmap) ${toString (lib.forEach disabledTests (t: "and not ${t}"))}'"
112 export OMP_NUM_THREADS=1
115 pythonImportsCheck = [ "sklearn" ];
118 description = "Set of python modules for machine learning and data mining";
121 major = versions.major version;
122 minor = versions.minor version;
123 dashVer = replaceStrings [ "." ] [ "-" ] version;
125 "https://scikit-learn.org/stable/whats_new/v${major}.${minor}.html#version-${dashVer}";
126 homepage = "https://scikit-learn.org";
127 license = licenses.bsd3;
128 maintainers = with maintainers; [ davhau ];