improve error msg when optional packages not available
See original GitHub issueIs your feature request related to a problem? Please describe.
from monai.bundle import ConfigParser
config = {"training": "$monai.handlers"}
parser = ConfigParser(config=config)
parser.get_parsed_content("training")
when ignite is not installed, the error is:
Traceback (most recent call last):
File "test.py", line 5, in <module>
parser.get_parsed_content("training")
File "/Users/Documents/MONAI/monai/bundle/config_parser.py", line 237, in get_parsed_content
return self.ref_resolver.get_resolved_content(id=id, **kwargs)
File "/Users/Documents/MONAI/monai/bundle/reference_resolver.py", line 182, in get_resolved_content
return self._resolve_one_item(id=id, **kwargs)
File "/Users/Documents/MONAI/monai/bundle/reference_resolver.py", line 166, in _resolve_one_item
item.evaluate(globals={f"{self._vars}": self.resolved_content}) if run_eval else item
File "/Users/Documents/MONAI/monai/bundle/config_item.py", line 367, in evaluate
return eval(value[len(self.prefix) :], globals_, locals)
File "<string>", line 1, in <module>
AttributeError: module 'monai' has no attribute 'handlers'
Issue Analytics
- State:
- Created a year ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Install step is run on optional package not supported by OS
error Error running install script for optional dependency: "C:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents: ...
Read more >Including Optional Functionality from Other Packages in Your ...
Introduction Let's say you want to write a function with optional functionality which is dependent on the installation of a package that ...
Read more >[comps] no way to install optional packages from a group
Error : No packages in any requested group available to install or upgrade. # dnf groupinstall "MATE Desktop" Warning: Group MATE Desktop does...
Read more >Moderncv package provides error for optional arguments: why?
If commands are defined with LaTeX's classical \newcommand interface, only the first argument can be optional, all other arguments are mandatory ...
Read more >Npm install gives warnings, npm audit fix not working
Upgrade all packages or at least reinstall them. Warning upgrading packages may cause issue with your code. back up everything ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @ericspod ,
I totally agree with it, sounds like a good plan. @wyli Do you have any other concerns? I think let’s keep this ticket open for a while.
Thanks.
It will take time and maybe best not to upset things for the upcoming release, I’m working on bundles for you right now too. The way that we’re importing everything at once with
load_submodules
perhaps should go but that will need a good bit of testing to make sure that everything continues to behave, so let’s leave this for next version and live with a bad error message for now?