1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 pythonOlder,
7 pythonAtLeast,
8 ninja,
9 ignite,
10 numpy,
11 pybind11,
12 torch,
13 which,
14}:
15
16buildPythonPackage rec {
17 pname = "monai";
18 version = "1.3.2";
19 pyproject = true;
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "Project-MONAI";
24 repo = "MONAI";
25 rev = "refs/tags/${version}";
26 hash = "sha256-wm4n3FuIXbE99RRLsGnZDeHtR/Tmj6C0s29pvflZg+o=";
27 };
28
29 patches = [
30 (fetchpatch {
31 name = "remove-distutils";
32 url = "https://github.com/Project-MONAI/MONAI/commit/87862f0d5730d42d282e779fc1450f18b4869863.patch";
33 hash = "sha256-wApYfugDPWcuxwmd91peNqc0+l+SoMlT8hhx99oI2Co=";
34 })
35 ];
36
37 preBuild = ''
38 export MAX_JOBS=$NIX_BUILD_CORES;
39 '';
40
41 nativeBuildInputs = [
42 ninja
43 which
44 ];
45 buildInputs = [ pybind11 ];
46 propagatedBuildInputs = [
47 numpy
48 torch
49 ignite
50 ];
51
52 BUILD_MONAI = 1;
53
54 doCheck = false; # takes too long; tries to download data
55
56 pythonImportsCheck = [
57 "monai"
58 "monai.apps"
59 "monai.data"
60 "monai.engines"
61 "monai.handlers"
62 "monai.inferers"
63 "monai.losses"
64 "monai.metrics"
65 "monai.optimizers"
66 "monai.networks"
67 "monai.transforms"
68 "monai.utils"
69 "monai.visualize"
70 ];
71
72 meta = with lib; {
73 description = "Pytorch framework (based on Ignite) for deep learning in medical imaging";
74 homepage = "https://github.com/Project-MONAI/MONAI";
75 changelog = "https://github.com/Project-MONAI/MONAI/releases/tag/${version}";
76 license = licenses.asl20;
77 maintainers = [ maintainers.bcdarwin ];
78 };
79}