question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

improve error msg when optional packages not available

See original GitHub issue

Is 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'

cc @dongyang0122 @Nic-Ma

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
Nic-Macommented, Jun 7, 2022

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.

1reaction
ericspodcommented, Jun 7, 2022

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found