🚀 The feature
Improve error message when torchcodec version is not compatible with torch version.
Before, user gets an obscure segmentation fault
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted (core dumped)
After, user gets a meaningful error message
Your version of `torchcodec` (0.8) is incompatible with `torch` (2.8.0)`. Please downgrade `torchcodec` to 0.7 of upgrade `torch` to `2.9.0`.
Motivation, pitch
For some reason, I (and a bunch of my pyannote.audio users) ended up with an environment with torchcodec 0.8 and torch 2.8.0 which (I understand from the docs) are incompatible.
Running import torchcodec with version 0.8 of torchcodec and version 2.8.0 of torch leads to an obscure bad_alloc error message (+ core dump).
An obvious solution would indeed be for pyannote.audio to pin torch and torchcodec versions but this usually leads to incompatibility with other libraries.
A nice error message would help users figure this out by themselves.