2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, fetchpatch
|
2021-03-09 03:18:52 +00:00
|
|
|
, gfortran
|
|
|
|
, glibcLocales
|
|
|
|
, numpy
|
|
|
|
, scipy
|
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
|
|
|
, cython
|
|
|
|
, joblib
|
|
|
|
, llvmPackages
|
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";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "1.1.3";
|
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;
|
2022-11-21 17:40:18 +00:00
|
|
|
sha256 = "sha256-vvUZeKUewZl3cA/nuGrs6knIJYhPOBF1a3SjsVK7TjU=";
|
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
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
scipy
|
|
|
|
numpy.blas
|
|
|
|
joblib
|
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
|
|
|
|
|
|
|
checkInputs = [ pytestCheckHook pytest-xdist ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
LC_ALL="en_US.UTF-8";
|
|
|
|
|
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;
|
|
|
|
dashVer = replaceChars ["."] ["-"] version;
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|