2018-10-15 18:11:39 +01:00
|
|
|
{ stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, pkgs
|
|
|
|
, numpy
|
|
|
|
, scipy
|
|
|
|
, enum34
|
|
|
|
, protobuf
|
|
|
|
, pip
|
|
|
|
, python
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2019-04-08 13:36:36 +01:00
|
|
|
inherit (pkgs.cntk) name version src;
|
2018-10-15 18:11:39 +01:00
|
|
|
|
2019-04-08 14:51:49 +01:00
|
|
|
nativeBuildInputs = [ pkgs.swig pkgs.openmpi ];
|
|
|
|
buildInputs = [ pkgs.cntk pkgs.openmpi ];
|
2018-10-15 18:11:39 +01:00
|
|
|
propagatedBuildInputs = [ numpy scipy enum34 protobuf pip ];
|
|
|
|
|
|
|
|
CNTK_LIB_PATH = "${pkgs.cntk}/lib";
|
|
|
|
CNTK_COMPONENT_VERSION = pkgs.cntk.version;
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
cd bindings/python
|
|
|
|
sed -i 's,"libmpi.so.12","${pkgs.openmpi}/lib/libmpi.so",g' cntk/train/distributed.py
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
rm -rf $out/${python.sitePackages}/cntk/libs
|
|
|
|
ln -s ${pkgs.cntk}/lib $out/${python.sitePackages}/cntk/libs
|
|
|
|
# It's not installed for some reason.
|
|
|
|
cp cntk/cntk_py.py $out/${python.sitePackages}/cntk
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Actual tests are broken.
|
|
|
|
checkPhase = ''
|
|
|
|
cd $NIX_BUILD_TOP
|
|
|
|
${python.interpreter} -c "import cntk"
|
|
|
|
'';
|
2019-04-08 13:36:36 +01:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
inherit (pkgs.cntk.meta) homepage description license maintainers;
|
|
|
|
# broken in CNTK 2.4 starting with python-3.7
|
|
|
|
# ("ImportError: cannot import name 'GenericMeta' from 'typing'")
|
|
|
|
broken = stdenv.lib.versionAtLeast python.version "3.7";
|
|
|
|
|
|
|
|
};
|
2018-10-15 18:11:39 +01:00
|
|
|
}
|