You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As can be seen above, by default they are set to 1, which indicates that the user wants to build torchvision with PNG and JPEG support. However, we don't require the dependencies, namely libpng and libjpeg to be present:
However, if users import torchvision after successful installation, they are met with this warning:
UserWarning: Failed to load image Python extension:
Unless they want to use the image functionality from torchvision.io, this is not an issue and #7150 is trying to fix that.
In the mean time, the behavior described above can lead to issues like #7036. Plus, there is also this really long thread in the user forum also reporting this (I'm aware that there are reports of this warning popping up from an official nightly release, but there are also people that face this after building from source).
IMO, we should discuss if we should accept that one of the image libraries is not available during build. Meaning, by default the libraries are required and the setup could simply fail if they are not found. If the user doesn't care about the I/O functionality they need to explicitly set USE_PNG=0 USE_JPEG=0 python setup.py install.
The text was updated successfully, but these errors were encountered:
@yichiac and I stumbled on this same issue when installing torchvision from source with Spack, where png/jpeg support is not installed by default.
Is it possible to issue this warning only when torchvision.io is imported, not when torchvision is imported?
Among the optional png, jpeg, nvjpeg, ffmpeg, and video_codec extensions, which would you recommend that Spack install by default? Users can of course toggle individual extensions themselves, just want to know what a good set of defaults is.
Is it possible to issue this warning only when torchvision.io is imported, not when torchvision is imported?
Yes, we should at least try to. Since it's slightly different from what this issue originally is for, do you mind opening a new issue for that @adamjstewart ?
just want to know what a good set of defaults is
It's going to depend on what they need to do but I would say libjpeg-turbo (or libjpeg, but it's not as fast) would be the bare minimum. I wouldn't recommend spending time trying to get nvjpeg and ffmpeg working at this point as most of our video decoding offering is not completely polished just yet.
To customize the installation, we have a few environment variables, e.g.
vision/setup.py
Lines 146 to 149 in 6a85ef2
As can be seen above, by default they are set to
1
, which indicates that the user wants to buildtorchvision
with PNG and JPEG support. However, we don't require the dependencies, namelylibpng
andlibjpeg
to be present:vision/setup.py
Lines 256 to 259 in 6a85ef2
vision/setup.py
Lines 291 to 292 in 6a85ef2
Only if one of the two is present, we simply build the image extension:
vision/setup.py
Lines 332 to 335 in 6a85ef2
However, if users
import torchvision
after successful installation, they are met with this warning:Unless they want to use the image functionality from
torchvision.io
, this is not an issue and #7150 is trying to fix that.In the mean time, the behavior described above can lead to issues like #7036. Plus, there is also this really long thread in the user forum also reporting this (I'm aware that there are reports of this warning popping up from an official nightly release, but there are also people that face this after building from source).
IMO, we should discuss if we should accept that one of the image libraries is not available during build. Meaning, by default the libraries are required and the setup could simply fail if they are not found. If the user doesn't care about the I/O functionality they need to explicitly set
USE_PNG=0 USE_JPEG=0 python setup.py install
.The text was updated successfully, but these errors were encountered: