2019-06-22 17:59:43 +02:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
2019-09-14 23:32:11 +02:00
|
|
|
, fetchpatch
|
2017-06-05 23:04:28 +02:00
|
|
|
, gfortran, glibcLocales
|
2018-11-12 12:58:40 +01:00
|
|
|
, numpy, scipy, pytest, pillow
|
2019-06-22 17:59:43 +02:00
|
|
|
, cython
|
|
|
|
, joblib
|
|
|
|
, llvmPackages
|
2017-06-05 23:04:28 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "scikit-learn";
|
2019-11-05 05:45:25 +01:00
|
|
|
version = "0.21.3";
|
2018-07-26 13:58:58 +02:00
|
|
|
# UnboundLocalError: local variable 'message' referenced before assignment
|
2018-07-29 10:44:20 +02:00
|
|
|
disabled = stdenv.isi686; # https://github.com/scikit-learn/scikit-learn/issues/5534
|
2017-06-05 23:04:28 +02:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2019-11-05 05:45:25 +01:00
|
|
|
sha256 = "eb9b8ebf59eddd8b96366428238ab27d05a19e89c5516ce294abc35cea75d003";
|
2017-06-05 23:04:28 +02:00
|
|
|
};
|
|
|
|
|
2019-06-22 17:59:43 +02:00
|
|
|
buildInputs = [
|
|
|
|
pillow
|
|
|
|
gfortran
|
|
|
|
glibcLocales
|
|
|
|
] ++ lib.optionals stdenv.cc.isClang [
|
|
|
|
llvmPackages.openmp
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cython
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
scipy
|
|
|
|
numpy.blas
|
|
|
|
joblib
|
|
|
|
];
|
2018-11-12 12:58:40 +01:00
|
|
|
checkInputs = [ pytest ];
|
2017-06-05 23:04:28 +02:00
|
|
|
|
2019-09-14 23:32:11 +02:00
|
|
|
patches = [
|
|
|
|
# Fixes tests by changing threshold of a test-case that broke
|
|
|
|
# with numpy versions >= 1.17. This should be removed for versions > 0.21.2.
|
|
|
|
( fetchpatch {
|
|
|
|
url = "https://github.com/scikit-learn/scikit-learn/commit/b730befc821caec5b984d9ff3aa7bc4bd7f4d9bb.patch";
|
|
|
|
sha256 = "0z36m05mv6d494qwq0688rgwa7c4bbnm5s2rcjlrp29fwn3fy1bv";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2017-06-05 23:04:28 +02:00
|
|
|
LC_ALL="en_US.UTF-8";
|
|
|
|
|
2018-11-13 13:59:20 +01:00
|
|
|
doCheck = !stdenv.isAarch64;
|
2018-11-12 12:58:40 +01:00
|
|
|
# Skip test_feature_importance_regression - does web fetch
|
2017-06-05 23:04:28 +02:00
|
|
|
checkPhase = ''
|
2018-11-12 12:58:40 +01:00
|
|
|
cd $TMPDIR
|
|
|
|
HOME=$TMPDIR OMP_NUM_THREADS=1 pytest -k "not test_feature_importance_regression" --pyargs sklearn
|
2017-06-05 23:04:28 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A set of python modules for machine learning and data mining";
|
|
|
|
homepage = http://scikit-learn.org;
|
|
|
|
license = licenses.bsd3;
|
2018-07-26 13:58:58 +02:00
|
|
|
maintainers = with maintainers; [ ];
|
2017-06-05 23:04:28 +02:00
|
|
|
};
|
|
|
|
}
|