meta-pytorch / meta-pytorch/torchcodec

Improve UX by letting the user know that their `torch` and `torchcodec` versions are incompatible

Open
#995 3 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.2k
Forks
125
Avg merge
22h 47m
Merged PRs (30d)
54

Description

🚀 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with import torchcodec using torchcodec 0.8 and torch 2.8.0. Trace the import path to find where the compatibility check can happen. Done means incompatible versions produce a meaningful error that identifies both versions and suggests compatible upgrades or downgrades instead of the obscure bad_alloc crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.