Commit 494c2dc
Report a missing nnunetv2 as an optional dependency in nnUNetV2Runner
`nnUNetV2Runner.__init__` imports `nnunetv2.configuration` directly, so
constructing the runner without nnunetv2 installed raises a bare
ModuleNotFoundError rather than MONAI's OptionalImportError. The dataset
lookup just above it is wrapped in a broad `except Exception`, which
swallows that same ImportError first and logs
Dataset with name/ID: 123 cannot be found in the record. ...
please check your input_config.
so the reported cause is the user's configuration, not the missing
package.
Decorate the class with `@require_pkg(pkg_name="nnunetv2")`, as is done
for other optional dependencies (ITKReader, NibabelReader, ...). The
failure now names the package and links the installation docs, and the
misleading dataset warning is no longer emitted.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Kirscher <tristan.kirscher@gmail.com>1 parent 87060c4 commit 494c2dc
2 files changed
Lines changed: 60 additions & 1 deletion
File tree
- monai/apps/nnunet
- tests/apps/nnunet
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
0 commit comments