2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
2024-01-13 08:15:51 +00:00
|
|
|
|
|
|
|
# build-system
|
|
|
|
, cython
|
2021-03-09 03:18:52 +00:00
|
|
|
, gfortran
|
|
|
|
, numpy
|
2024-01-13 08:15:51 +00:00
|
|
|
, oldest-supported-numpy
|
2021-03-09 03:18:52 +00:00
|
|
|
, scipy
|
2024-01-13 08:15:51 +00:00
|
|
|
, setuptools
|
|
|
|
|
|
|
|
# native dependencies
|
|
|
|
, glibcLocales
|
|
|
|
, llvmPackages
|
2021-05-20 23:08:51 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, pytest-xdist
|
2021-03-09 03:18:52 +00:00
|
|
|
, pillow
|
2020-04-24 23:36:52 +00:00
|
|
|
, joblib
|
2020-06-15 15:56:04 +00:00
|
|
|
, threadpoolctl
|
2021-03-09 03:18:52 +00:00
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "scikit-learn";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "1.4.0";
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-1Dc8mE66IOOTIW7dUaPj7t5Wy+k9QkdRbSBWQ8O5MSE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
pillow
|
|
|
|
glibcLocales
|
|
|
|
] ++ lib.optionals stdenv.cc.isClang [
|
|
|
|
llvmPackages.openmp
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cython
|
2021-09-26 12:46:18 +00:00
|
|
|
gfortran
|
2024-01-13 08:15:51 +00:00
|
|
|
numpy
|
|
|
|
oldest-supported-numpy
|
|
|
|
scipy
|
|
|
|
setuptools
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2024-01-13 08:15:51 +00:00
|
|
|
joblib
|
2020-04-24 23:36:52 +00:00
|
|
|
numpy
|
|
|
|
numpy.blas
|
2024-01-13 08:15:51 +00:00
|
|
|
scipy
|
2020-06-15 15:56:04 +00:00
|
|
|
threadpoolctl
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
pytest-xdist
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
env.LC_ALL="en_US.UTF-8";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
preBuild = ''
|
|
|
|
export SKLEARN_BUILD_PARALLEL=$NIX_BUILD_CORES
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
doCheck = !stdenv.isAarch64;
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
disabledTests = [
|
|
|
|
# Skip test_feature_importance_regression - does web fetch
|
|
|
|
"test_feature_importance_regression"
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
# failing on macos
|
|
|
|
"check_regressors_train"
|
|
|
|
"check_classifiers_train"
|
|
|
|
"xfail_ignored_in_check_estimator"
|
2022-11-21 17:40:18 +00:00
|
|
|
] ++ lib.optionals (stdenv.isDarwin) [
|
|
|
|
"test_graphical_lasso"
|
2021-05-28 09:39:13 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
# verbose build outputs needed to debug hard-to-reproduce hydra failures
|
|
|
|
"-v"
|
|
|
|
"--pyargs" "sklearn"
|
|
|
|
|
|
|
|
# NuSVC memmap tests causes segmentation faults in certain environments
|
|
|
|
# (e.g. Hydra Darwin machines) related to a long-standing joblib issue
|
|
|
|
# (https://github.com/joblib/joblib/issues/563). See also:
|
|
|
|
# https://github.com/scikit-learn/scikit-learn/issues/17582
|
|
|
|
# Since we are overriding '-k' we need to include the 'disabledTests' from above manually.
|
|
|
|
"-k" "'not (NuSVC and memmap) ${toString (lib.forEach disabledTests (t: "and not ${t}"))}'"
|
|
|
|
];
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
preCheck = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
cd $TMPDIR
|
2021-05-20 23:08:51 +00:00
|
|
|
export HOME=$TMPDIR
|
|
|
|
export OMP_NUM_THREADS=1
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
pythonImportsCheck = [ "sklearn" ];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A set of python modules for machine learning and data mining";
|
2020-05-15 21:57:56 +00:00
|
|
|
changelog = let
|
|
|
|
major = versions.major version;
|
|
|
|
minor = versions.minor version;
|
2022-12-17 10:02:37 +00:00
|
|
|
dashVer = replaceStrings ["."] ["-"] version;
|
2020-05-15 21:57:56 +00:00
|
|
|
in
|
|
|
|
"https://scikit-learn.org/stable/whats_new/v${major}.${minor}.html#version-${dashVer}";
|
2020-05-03 17:38:23 +00:00
|
|
|
homepage = "https://scikit-learn.org";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd3;
|
2021-05-28 09:39:13 +00:00
|
|
|
maintainers = with maintainers; [ davhau ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|