Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function 'optional_import_error_message' masks ImportError with generic message #10

Open
jaeheonshim opened this issue Dec 19, 2024 · 0 comments

Comments

@jaeheonshim
Copy link

I believe that the optional_import_error_message function is hiding specific import error messages and replacing them with a generic one, making errors hard to diagnose. For instance, in src/mattertune/backbones/jmp/model.py, the function is used on line 229 like so:

with optional_import_error_message("jmp"):
       from jmp.models.gemnet import GemNetOCBackbone  # type: ignore[reportMissingImports] # noqa
       from jmp.models.gemnet.graph import GraphComputer  # type: ignore[reportMissingImports] # noqa

While trying to set up this package myself, I kept getting the error ImportError: The jmp package is not installed. Please install it by running pip install jmp even though I had already installed the jmp backbone. Upon further investigation, it turned out the package I needed was actually nshtrainer as jmp.models.gemnet was importing this module and thus not getting resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant