vision: Automated testing discovered that `image::read_png` sometimes can not be initialized on Windows
🐛 Describe the bug
See https://github.com/pytorch/pytorch.github.io/runs/4042987825?check_suite_focus=true
Several Windows configuration tests of torchvision failed with No such operator image::decode_png
Versions
0.11.1
cc @peterjc123 @nbcsm @guyang3532 @maxluk @gunandrose4u @mszhanyi
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 26 (26 by maintainers)
Commits related to this issue
- [Windows] Workaround for loading bundled DLLs Python-3.8+ adds `add_dll_directory` call, see https://docs.python.org/3/whatsnew/3.8.html#ctypes Simulate this behaviour on older versions of Python run... — committed to pytorch/vision by malfet 3 years ago
- [Windows] Workaround for loading bundled DLLs Python-3.8+ adds `add_dll_directory` call, see https://docs.python.org/3/whatsnew/3.8.html#ctypes Simulate this behaviour on older versions of Python run... — committed to pytorch/vision by malfet 3 years ago
- [Windows] Workaround for loading bundled DLLs Python-3.8+ adds `add_dll_directory` call, see https://docs.python.org/3/whatsnew/3.8.html#ctypes Simulate this behaviour on older versions of Python run... — committed to pytorch/vision by malfet 3 years ago
- [Windows] Workaround for loading bundled DLLs Python-3.8+ adds `add_dll_directory` call, see https://docs.python.org/3/whatsnew/3.8.html#ctypes Simulate this behaviour on older versions of Python run... — committed to pytorch/vision by malfet 3 years ago
- [Windows] Workaround for loading bundled DLLs (#4893) * [Windows] Workaround for loading bundled DLLs Python-3.8+ adds `add_dll_directory` call, see https://docs.python.org/3/whatsnew/3.8.html#cty... — committed to pytorch/vision by malfet 3 years ago
- [Windows] Workaround for loading bundled DLLs (#4893) * [Windows] Workaround for loading bundled DLLs Python-3.8+ adds `add_dll_directory` call, see https://docs.python.org/3/whatsnew/3.8.html#ctype... — committed to pytorch/vision by malfet 3 years ago
- [fbsync] [Windows] Workaround for loading bundled DLLs (#4893) Summary: * [Windows] Workaround for loading bundled DLLs Python-3.8+ adds `add_dll_directory` call, see https://docs.python.org/3/whats... — committed to pytorch/vision by datumbox 3 years ago
I think the cause of this problem is quite clear. First, In PyTorch, we use
LoadLibraryEx
and thenLoadLibrary
to load in the dependencies, but in torchvision, it relies ontorch.ops.load_library
, which usesctypes.CDLL
. (It usesLoadLibrary
as the underlying API.) The behavior is inconsistent. Second, in PyTorch, we useAddDllDirectory
andPATH
for dependency resolving, but we do nothing whentorch.ops.load_library
is called. Actually, we should do the same, that is to add the directory containing the DLLs for dependency search.Links:
torch.ops.load_library
: https://github.com/pytorch/pytorch/blob/master/torch/_ops.py#L84-L111It was easier when packaging the wheels, but statically compiling it into the image extension should fix these kind of issues indeed. However, OpenCV and other libraries also opt to dynamically link to libpng and other libraries.
@andfoy looks like for some configurations libjpeg and libpng are not being found on Windows. Can you have a look?