-
Notifications
You must be signed in to change notification settings - Fork 7.1k
torchvision.io: don't warn about missing image libraries unless necessary #8192
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
Comments
Hi @NicolasHug, I would like to work on this issue if it is for beginners. Can you suggest me how may I proceed? |
I recently re-worked our extension compilation logic and the Because of this recent change, I'm having a hard time imagining a scenario where this warning is emitted and undesirable. @adamjstewart can you remind me exact the scenario where you got this warning? Was it when building from source in specific conditions? When installing the stable version? |
It was when building from source, stable releases, but no libjpeg/libpng installed on the OS. |
Thanks for confirming. I understand why this was causing an undesirable warning in the past. Now that we always build |
I'm fine with closing this if you want, although I'm also hoping for an option to build with external giflib and disable that in the future. |
Do you mean to dynamically link against giflib instead of statically? If so, why is that the case? (also let me know about #8406 (comment) please :) ) |
Replied to that thread, I mean building with a non-vendored copy of giflib. |
I've been looking into this a bit more. I tried using a lazy importing strategy like in https://peps.python.org/pep-0562/, so that the problematic
So, I'm afraid the only way to make this warning lazy is to only raise it when the functions are called. Which adds an extra check to each call... |
🐛 Describe the bug
If no image libraries are installed, the following will warn:
>>> import torchvision UserWarning: Failed to load image Python extension:
I propose we only warn when importing
torchvision.io
or when using a specific function that requires one of these image libraries.Related to #7151
Versions
The text was updated successfully, but these errors were encountered: