1{ stdenv, buildPythonPackage, fetchPypi
2, gfortran, glibcLocales
3, numpy, scipy, pytest, pillow
4}:
5
6# 0.20.x is the last version that maintains python2 compatibility
7
8buildPythonPackage rec {
9 pname = "scikit-learn";
10 version = "0.20.4";
11 # UnboundLocalError: local variable 'message' referenced before assignment
12 disabled = stdenv.isi686; # https://github.com/scikit-learn/scikit-learn/issues/5534
13
14 src = fetchPypi {
15 inherit pname version;
16 sha256 = "1z3w2c50dwwa297j88pr16pyrjysagsvdj7vrlq40q8777rs7a6z";
17 };
18
19 buildInputs = [ pillow gfortran glibcLocales ];
20 propagatedBuildInputs = [ numpy scipy numpy.blas ];
21 checkInputs = [ pytest ];
22
23 LC_ALL="en_US.UTF-8";
24
25 doCheck = !stdenv.isAarch64;
26 # Skip test_feature_importance_regression - does web fetch
27 checkPhase = ''
28 cd $TMPDIR
29 HOME=$TMPDIR OMP_NUM_THREADS=1 pytest -k "not test_feature_importance_regression" --pyargs sklearn
30 '';
31
32 meta = with stdenv.lib; {
33 description = "A set of python modules for machine learning and data mining";
34 homepage = "https://scikit-learn.org";
35 license = licenses.bsd3;
36 maintainers = with maintainers; [ ];
37 };
38}