Skip to content

Conversation

@traversaro
Copy link
Collaborator

@traversaro traversaro commented Aug 22, 2025

I am not 100% sure about this change, but without this change the torchcodec build of conda-forge fails after the upgrade from pybind11 2.* to pybind11 3.* during tests with error like:

 │ =========================== short test summary info ============================
 │ FAILED test/test_decoders.py::TestDecoder::test_create[file_like_rawio-VideoDecoder-asset0] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_decoders.py::TestDecoder::test_create[file_like_rawio-AudioDecoder-asset1] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_decoders.py::TestDecoder::test_create[file_like_rawio-AudioDecoder-asset2] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_decoders.py::TestDecoder::test_create[file_like_bufferedio-VideoDecoder-asset0] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_decoders.py::TestDecoder::test_create[file_like_bufferedio-AudioDecoder-asset1] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_decoders.py::TestDecoder::test_create[file_like_bufferedio-AudioDecoder-asset2] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_decoders.py::TestDecoder::test_create[file_like_custom-VideoDecoder-asset0] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_decoders.py::TestDecoder::test_create[file_like_custom-AudioDecoder-asset1] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_decoders.py::TestDecoder::test_create[file_like_custom-AudioDecoder-asset2] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_ops.py::TestVideoDecoderOps::test_create_decoder[file_like_rawio-cpu] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_ops.py::TestVideoDecoderOps::test_create_decoder[file_like_bufferedio-cpu] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_ops.py::TestAudioDecoderOps::test_file_like_decoding[cpu-0] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_ops.py::TestAudioDecoderOps::test_file_like_decoding[cpu-1024] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_ops.py::TestAudioDecoderOps::test_file_like_method_check_fails - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_ops.py::TestAudioDecoderOps::test_file_like_read_fails - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_ops.py::TestAudioDecoderOps::test_file_like_read_less_than_requested[half] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ FAILED test/test_ops.py::TestAudioDecoderOps::test_file_like_read_less_than_requested[minus_10] - AttributeError: module 'core_pybind_ops' has no attribute 'create_from_file_like'
 │ ============ 17 failed, 702 passed, 98 skipped in 109.81s (0:01:49) ============

to be honest, I do not know enough about Python module loading to understand why this happens in conda-forge CI, and not in torchcodec CI that also uses pybind11 3.* . However, the problem goes away if after loading the module, we also execute spec.loader.exec_module . Looking around it seems that this may be related to multi-phase init (for example pybind/pybind11#5574), but to be honest I do not know enough about that to understand if that is the case.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 22, 2025
@traversaro
Copy link
Collaborator Author

Sorry for the branch noise, I did not realized that GitHub started creating branch inside torchcodec itself, my bad!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants