2022-08-21 13:32:41 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pythonOlder
|
|
|
|
, ninja
|
|
|
|
, ignite
|
|
|
|
, numpy
|
|
|
|
, pybind11
|
2022-09-09 14:08:57 +00:00
|
|
|
, torch
|
2022-08-21 13:32:41 +00:00
|
|
|
, which
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "monai";
|
2022-09-09 14:08:57 +00:00
|
|
|
version = "0.9.1";
|
2022-08-21 13:32:41 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Project-MONAI";
|
|
|
|
repo = "MONAI";
|
|
|
|
rev = version;
|
2022-09-09 14:08:57 +00:00
|
|
|
hash = "sha256-GU439svMHY1qIUZ0gM5c5tt6G1hh9eAHYV+38Munw9I=";
|
2022-08-21 13:32:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Ninja is not detected by setuptools for some reason even though it's present:
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace "setup.cfg" --replace "ninja" ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
export MAX_JOBS=$NIX_BUILD_CORES;
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ ninja which ];
|
|
|
|
buildInputs = [ pybind11 ];
|
2022-09-09 14:08:57 +00:00
|
|
|
propagatedBuildInputs = [ numpy torch ignite ];
|
2022-08-21 13:32:41 +00:00
|
|
|
|
|
|
|
BUILD_MONAI = 1;
|
|
|
|
|
|
|
|
doCheck = false; # takes too long; numerous dependencies, some not in Nixpkgs
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"monai"
|
|
|
|
"monai.apps"
|
|
|
|
"monai.data"
|
|
|
|
"monai.engines"
|
|
|
|
"monai.handlers"
|
|
|
|
"monai.inferers"
|
|
|
|
"monai.losses"
|
|
|
|
"monai.metrics"
|
|
|
|
"monai.optimizers"
|
|
|
|
"monai.networks"
|
|
|
|
"monai.transforms"
|
|
|
|
"monai.utils"
|
|
|
|
"monai.visualize"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Pytorch framework (based on Ignite) for deep learning in medical imaging";
|
|
|
|
homepage = "https://github.com/Project-MONAI/MONAI";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = [ maintainers.bcdarwin ];
|
|
|
|
};
|
|
|
|
}
|