You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Print what package should be installed when suitable writer is missing #7980
Is your feature request related to a problem? Please describe.
I used SaveImage(..., output_ext=".png") but got this error message
monai.utils.module.OptionalImportError: No ImageWriter backend found for png.
This was after pip install monai in a clean environment.
Describe the solution you'd like
It would be great if the error message would include a description of how to fix the issue, e..g. "Please install pillow". Initially I installed simpleitk which also didn't have the png writer apparently, and I got the same error.
Hi, I’ve submitted a fix for this issue in PR #8625. The PR adds a clearer error message when SaveImage can’t find a suitable writer and points users to the package they need to install (e.g. Pillow). Please take a look when you have a moment.
Hi @vikasreddy11 please see my comment above about the many solutions that have been proposed already. I'd like to coordinate amongst the participants so we can acknowledge everyone's work so I need people to respond. I think your proposed solution in #8853 overlaps with others here but we can integrate these all together somehow. Please give me a bit of time to coordinate here.
@ericspod - originally the plan was to have ITK/Nibabbel as the primary IO methods. They offer support for the greatest number of formats, including PNG, tiff, .... Perhaps that is a better approach than Pillow et al? Perhaps there is a way to simplify the install options - right now there are over 40. Keep all 40 as-is, but also provide meta-groups: pathology (cucim, tiffile, itk,..), research (tensorboard, pandas, matplotlib), gpu (torch, ...).
@ericspod - originally the plan was to have ITK/Nibabbel as the primary IO methods. They offer support for the greatest number of formats, including PNG, tiff, .... Perhaps that is a better approach than Pillow et al? Perhaps there is a way to simplify the install options - right now there are over 40. Keep all 40 as-is, but also provide meta-groups: pathology (cucim, tiffile, itk,..), research (tensorboard, pandas, matplotlib), gpu (torch, ...).
We can look to consolidate the dependencies definitely, we do have groups for different components in setup.cfg but we should modernise the configuration files to put these into the pyproject.toml file. One concern using the ITK library is that the package can be upwards of 1.4GiB installed. This might have been an issue in the past with environments like Colab in terms of space.
noorfatimacheema249-design commented on Jun 19, 2026
Hi, I’d like to work on this. My plan: update the SaveImage / writer backend error to include suggested packages by extension (e.g. for png suggest pip install pillow), add a small unit test and open a PR. If there’s any preferred message wording or list of extensions/packages you want me to use, please let me know.
Hi @noorfatimacheema249-design I would suggest holding off on working on this issue, there's a number of submissions related to it already. Please have a look at the comment above, I'm trying to coordinate existing efforts and will come back to this shortly. If you have any comments on the existing PRs or the issue itself we definitely appreciate any effort.
Hi @NiketGirdhar22@vectorvp@songhahaha66@yashnaiduu@haoyu-haoyu@Talhax55z@its-serah, @abishop1990 We have many approaches here to the solution of feedback for missing packages. I feel that #8989 is more of the right direction in that the missing package is stored in the raised exception which can then be used to construct a hint message about what to install. This would then be the approach to use for improving the reader as well which would address issue #7437, perhaps by updating #8522 to use this information. A few of your approaches use fixed lists of dependencies which are looked up to find hint strings, I feel this is less flexible than using the exception to tell us what didn't import. Please have a look at #8989 but I think we'll be going with that shortly, we can then work out what to do with other PRs and credit for contribution.
Hi @ericspod — flagging PR #9142 here since you're coordinating the efforts on this issue. It follows exactly the direction you describe: OptionalImportError stores the missing package name (pkg_name), require_pkg populates it (appending the version constraint, e.g. torch>=10000, when a version is required), and resolve_writer constructs the install hint from the raised exceptions of the unavailable candidate writers. The only lookup is the unavoidable PIL → pillow import-name-to-distribution translation; there are no fixed extension/package tables, so custom require_pkg-decorated writers get hints for free. DCO, pre-commit, DeepSource and CodeRabbit all pass, and tests.min_tests (9.8k tests) passes locally. Happy to defer to #8989 or help consolidate whichever submission you prefer — the same pkg_name mechanism should transfer cleanly to the reader side for #7437/#8522 as well.
Hi @ericspod, thanks for coordinating. My PRs #8795 (static install hint) and #8796 (LoadImage reader error, related to #7437) use the fixed-list approach, so
I agree #8989 / #9142 is the better direction. I'm happy to close #8795 in favour
of those. Once the pkg_name mechanism is merged I can rebase #8796 onto it for the
reader side, or close it too, whichever you prefer. @holgerroth
Hi @holgerroth and team,
I am a Computer Science undergraduate working with deep learning medical datasets in PyTorch. I would love to claim this issue to improve the error messaging logic for missing ImageWriter backends if it is currently available.
I will trace the execution path where the suitable writer selection fails and add an actionable exception string guiding the user to the correct optional package installation (pip install monai[...]). Please assign this ticket to me!
Activity
holgerroth commentedon Aug 1, 2024
Same would apply for LoadImage and image readers for different formats
Print what package should be installed when suitable writer is missing
Print what package should be installed when suitable writer is missing
Matteoilgiaco commentedon Sep 30, 2025
Hi, can i work on this issue?
I'm a beginner and i'm a self learner.
holgerroth commentedon Sep 30, 2025
Hi @Matteoilgiaco , that would be great! Thanks for your interest in contributing to MONAI.
iloveme81189-del commentedon Oct 12, 2025
Can i work on this issue. if the issue resolved can i add on my resume as contribution
Add test_env.py and test_writer_error.py for error handling patch (Pr…
holgerroth commentedon Oct 12, 2025
@iloveme81189-del. Please coordinate with @Matteoilgiaco. Maybe you two can collaborate on this task?
Fix Project-MONAI#7980: Add detailed error messages with installation…
songhahaha66 commentedon Nov 5, 2025
Hi, I’ve submitted a fix for this issue in PR #8625. The PR adds a clearer error message when SaveImage can’t find a suitable writer and points users to the package they need to install (e.g. Pillow). Please take a look when you have a moment.
feat: add installation hints for missing image writers Project-MONAI#…
feat: add installation hints for missing image writers Project-MONAI#…
8 remaining items
ericspod commentedon May 17, 2026
Hi @vikasreddy11 please see my comment above about the many solutions that have been proposed already. I'd like to coordinate amongst the participants so we can acknowledge everyone's work so I need people to respond. I think your proposed solution in #8853 overlaps with others here but we can integrate these all together somehow. Please give me a bit of time to coordinate here.
aylward commentedon May 17, 2026
@ericspod - originally the plan was to have ITK/Nibabbel as the primary IO methods. They offer support for the greatest number of formats, including PNG, tiff, .... Perhaps that is a better approach than Pillow et al? Perhaps there is a way to simplify the install options - right now there are over 40. Keep all 40 as-is, but also provide meta-groups: pathology (cucim, tiffile, itk,..), research (tensorboard, pandas, matplotlib), gpu (torch, ...).
ericspod commentedon May 21, 2026
We can look to consolidate the dependencies definitely, we do have groups for different components in
setup.cfgbut we should modernise the configuration files to put these into thepyproject.tomlfile. One concern using the ITK library is that the package can be upwards of 1.4GiB installed. This might have been an issue in the past with environments like Colab in terms of space.noorfatimacheema249-design commentedon Jun 19, 2026
Hi, I’d like to work on this. My plan: update the SaveImage / writer backend error to include suggested packages by extension (e.g. for png suggest pip install pillow), add a small unit test and open a PR. If there’s any preferred message wording or list of extensions/packages you want me to use, please let me know.
ericspod commentedon Jun 25, 2026
Hi @noorfatimacheema249-design I would suggest holding off on working on this issue, there's a number of submissions related to it already. Please have a look at the comment above, I'm trying to coordinate existing efforts and will come back to this shortly. If you have any comments on the existing PRs or the issue itself we definitely appreciate any effort.
ericspod commentedon Jul 16, 2026
Hi @NiketGirdhar22 @vectorvp @songhahaha66 @yashnaiduu @haoyu-haoyu @Talhax55z @its-serah, @abishop1990 We have many approaches here to the solution of feedback for missing packages. I feel that #8989 is more of the right direction in that the missing package is stored in the raised exception which can then be used to construct a hint message about what to install. This would then be the approach to use for improving the reader as well which would address issue #7437, perhaps by updating #8522 to use this information. A few of your approaches use fixed lists of dependencies which are looked up to find hint strings, I feel this is less flexible than using the exception to tell us what didn't import. Please have a look at #8989 but I think we'll be going with that shortly, we can then work out what to do with other PRs and credit for contribution.
Improve missing image writer dependency hints
Add failing tests for image writer install hints
Improve missing image writer dependency hints
Print missing packages to install when no suitable ImageWriter is found
Print missing packages to install when no suitable ImageWriter is found
Print missing packages to install when no suitable ImageWriter is found
Pushpak731 commentedon Sep 29, 2026
Hi @ericspod — flagging PR #9142 here since you're coordinating the efforts on this issue. It follows exactly the direction you describe:
OptionalImportErrorstores the missing package name (pkg_name),require_pkgpopulates it (appending the version constraint, e.g.torch>=10000, when a version is required), andresolve_writerconstructs the install hint from the raised exceptions of the unavailable candidate writers. The only lookup is the unavoidablePIL→pillowimport-name-to-distribution translation; there are no fixed extension/package tables, so customrequire_pkg-decorated writers get hints for free. DCO, pre-commit, DeepSource and CodeRabbit all pass, andtests.min_tests(9.8k tests) passes locally. Happy to defer to #8989 or help consolidate whichever submission you prefer — the samepkg_namemechanism should transfer cleanly to the reader side for #7437/#8522 as well.Talhax55z commentedon Oct 1, 2026
Hi @ericspod, thanks for coordinating. My PRs #8795 (static install hint) and
#8796 (LoadImage reader error, related to #7437) use the fixed-list approach, so
I agree #8989 / #9142 is the better direction. I'm happy to close #8795 in favour
of those. Once the pkg_name mechanism is merged I can rebase #8796 onto it for the
reader side, or close it too, whichever you prefer.
@holgerroth
wajidcodes commentedon Oct 10, 2026
Hi @holgerroth and team,
I am a Computer Science undergraduate working with deep learning medical datasets in PyTorch. I would love to claim this issue to improve the error messaging logic for missing ImageWriter backends if it is currently available.
I will trace the execution path where the suitable writer selection fails and add an actionable exception string guiding the user to the correct optional package installation (pip install monai[...]). Please assign this ticket to me!