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

Improve error when architecture deps are missing #350

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

PicoCentauri
Copy link
Contributor

@PicoCentauri PicoCentauri commented Oct 3, 2024

Currently, when one wants to run an architecture and the dependencies is missing we display the default import error about the missing package. This may not really helpful.

I changed this behavior that users get an error message suggesting to install the specific extras of their architecture.

Contributor (creator of pull-request) checklist

  • Tests updated (for new features and bugfixes)?
  • Documentation updated (for new features)?
  • Issue referenced (for PRs that solve an issue)?

📚 Documentation preview 📚: https://metatrain--350.org.readthedocs.build/en/350/

raise ImportError(
f"Trying to import '{name}' but architecture dependencies "
f"seem not be installed. \n"
f"Try to install them with `pip install .[{name_for_deps}]`"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
f"Try to install them with `pip install .[{name_for_deps}]`"
f"Try to install them with `pip install metatrain[{name_for_deps}]`"


match = (
rf"Trying to import '{name}' but architecture dependencies seem not be "
rf"installed. \nTry to install them with `pip install .\[{name_for_deps}\]`"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rf"installed. \nTry to install them with `pip install .\[{name_for_deps}\]`"
rf"installed. \nTry to install them with `pip install metatrain\[{name_for_deps}\]`"

@PicoCentauri PicoCentauri merged commit 161fd56 into main Oct 4, 2024
12 checks passed
@PicoCentauri PicoCentauri deleted the better-import-error branch October 4, 2024 16:10
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

Successfully merging this pull request may close these issues.

2 participants