-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[WIP] [discussion] Re-raise logger import warnings when not installed #1489
[WIP] [discussion] Re-raise logger import warnings when not installed #1489
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, we do not force a user to install all loggers, that is also the reason why we have extras not all loggers in requirements...
Codecov Report
@@ Coverage Diff @@
## master #1489 +/- ##
======================================
- Coverage 91% 91% -0%
======================================
Files 67 67
Lines 3745 3747 +2
======================================
Hits 3403 3403
- Misses 342 344 +2 |
ok I see, I thought these errors are only raised when the user imports it. |
ok I understand now that my fix won't work, but my intention was simply to allow the custom error message to pass to the top level in case the user imports |
I see your point and agree that we shall raise import error even when user explicitly imports logger from |
the actual error message is:
|
I think it is not possible. The only thing we could do is add a note to the documentation that the user needs to manually install the logger. Should I do this? Can directly add it to this PR #1484 . What do you think? |
ok, pls add a note to the docs-logger PR and let's also keep this open for a while if we find another way to using loggers... |
this is probably an unsolvable problem, let's close it @Borda ? |
I think, what we could do here: have all imports to these packages locally inside the logger classes. This way we can normally import them and don't have to catch |
@awaelchli If you enable edit from contributors for your PR I can do it. Should be a rather quick fix :) |
It's already turned on but I think it won't work because here I was still using my own fork when I submitted the PR. Feel free to submit a fresh PR since I have not really changed anything here :) |
Before submitting
What does this PR do?
When importing a logger this way
from pytorch_lightning.loggers.wandb import WandbLogger
an error message will be printed if the package is not installed.
However, if we import from the top level module, i.e.,
from pytorch_lightning.loggers import WandbLogger
the error message is discarded.
This PR fixes that.
Probably what is happening in #1487.
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃