1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, pytest 5, nose 6, isPy27 7, numpy 8, scipy 9, sparse 10, pytorch 11}: 12 13buildPythonPackage rec { 14 pname = "tensorly"; 15 version = "0.4.5"; 16 disabled = isPy27; 17 18 src = fetchFromGitHub { 19 owner = pname; 20 repo = pname; 21 rev = version; 22 sha256 = "1ml91yaxwx4msisxbm92yf22qfrscvk58f3z2r1jhi96pw2k4i7x"; 23 }; 24 25 propagatedBuildInputs = [ numpy scipy sparse ] 26 ++ lib.optionals (!doCheck) [ nose ]; # upstream added nose to install_requires 27 28 checkInputs = [ pytest nose pytorch ]; 29 # also has a cupy backend, but the tests are currently broken 30 # (e.g. attempts to access cupy.qr instead of cupy.linalg.qr) 31 # and this backend also adds a non-optional CUDA dependence, 32 # as well as tensorflow and mxnet backends, but the tests don't 33 # seem to exercise these backend by default 34 35 # uses >= 140GB of ram to test 36 doCheck = false; 37 checkPhase = '' 38 runHook preCheck 39 nosetests -e "test_cupy" 40 runHook postCheck 41 ''; 42 43 pythonImportsCheck = [ "tensorly" ]; 44 45 meta = with lib; { 46 description = "Tensor learning in Python"; 47 homepage = "https://tensorly.org/"; 48 license = licenses.bsd3; 49 maintainers = [ maintainers.bcdarwin ]; 50 }; 51}