at 23.05-pre 1.4 kB view raw
1{ lib 2, buildPythonPackage 3, pkgs 4, numpy 5, scipy 6, mpi 7, enum34 8, protobuf 9, pip 10, python 11, swig 12}: 13 14let 15 cntk = pkgs.cntk; 16in 17buildPythonPackage { 18 inherit (cntk) name version src; 19 20 nativeBuildInputs = [ swig mpi ]; 21 buildInputs = [ cntk mpi ]; 22 propagatedBuildInputs = [ numpy scipy enum34 protobuf pip ]; 23 24 CNTK_LIB_PATH = "${cntk}/lib"; 25 CNTK_COMPONENT_VERSION = cntk.version; 26 CNTK_VERSION = cntk.version; 27 CNTK_VERSION_BANNER = cntk.version; 28 29 postPatch = '' 30 cd bindings/python 31 sed -i 's,"libmpi.so.12","${mpi}/lib/libmpi.so",g' cntk/train/distributed.py 32 33 # Remove distro and libs checks; they aren't compatible with NixOS and besides we guarantee 34 # compatibility by providing a package. 35 cat <<EOF > cntk/cntk_py_init.py 36 def cntk_check_distro_info(): 37 pass 38 def cntk_check_libs(): 39 pass 40 EOF 41 ''; 42 43 postInstall = '' 44 rm -rf $out/${python.sitePackages}/cntk/libs 45 ln -s ${cntk}/lib $out/${python.sitePackages}/cntk/libs 46 # It's not installed for some reason. 47 cp cntk/cntk_py.py $out/${python.sitePackages}/cntk 48 ''; 49 50 # Actual tests are broken. 51 checkPhase = '' 52 cd $NIX_BUILD_TOP 53 ${python.interpreter} -c "import cntk" 54 ''; 55 56 meta = { 57 inherit (cntk.meta) homepage description license maintainers platforms; 58 # doesn't support Python 3.7 59 broken = lib.versionAtLeast python.version "3.7"; 60 }; 61}