Repository navigation
Print what package should be installed when suitable writer is missing #7980
Description
Activity
Same would apply for LoadImage and image readers for different formats
- addedenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
on Aug 1, 2024 - added 2 commits that reference this issue
on Aug 7, 2024 Hi, can i work on this issue?
I'm a beginner and i'm a self learner.Hi @Matteoilgiaco , that would be great! Thanks for your interest in contributing to MONAI.
Can i work on this issue. if the issue resolved can i add on my resume as contribution
- added a commit that references this issue
on Oct 12, 2025 @iloveme81189-del. Please coordinate with @Matteoilgiaco. Maybe you two can collaborate on this task?
- added a commit that references this issue
on Oct 12, 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.
8 remaining items
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.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 commented
on Jun 19, 2026 More actionsHi, 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.
- added 3 commits that reference this issue
on Jul 26, 2026 - added 3 commits that reference this issue
on 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.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.
@holgerrothHi @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!
Is your feature request related to a problem? Please describe.
I used
SaveImage(..., output_ext=".png")but got this error messageThis was after
pip install monaiin 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.
Describe alternatives you've considered
n/a
Additional context
Happened with
monai==1.3.2