# PyTorch "undefined symbol" torchvision/torch ABI mismatch in CI

> Fix torchvision/torchaudio "undefined symbol" ImportError in CI - the extension was compiled against a different torch version than the one installed (C++ ABI mismatch).

Source: https://latchkey.dev/learn/python/torch-undefined-symbol-abi-mismatch-in-ci  
Updated: 2026-06-30

Importing torchvision or torchaudio fails because its compiled C++ extension references a symbol that the installed torch build does not export. The companion package was built against a different torch version than the one present.

## Diagnose it: is it the build backend or a missing system library?

Python packaging failures in CI split into build-backend configuration problems and missing system headers. The traceback usually points at the backend even when the real cause is an absent `-dev` package.

```Terminal
python -m pip install --upgrade pip build
python -m build --wheel 2>&1 | tail -40

# a compiler error naming a .h file is a system dependency, not a Python one
#   e.g. "Python.h: No such file" -> python3-dev
#        "openssl/ssl.h"          -> libssl-dev
```

## FAQ

### What causes PyTorch "undefined symbol" torchvision/torch ABI mismatch in CI?

There are 2 common causes: torch and torchvision versions are mismatched and mixed cpu and cuda wheels. torchvision is pinned to an exact torch version.

### How do I fix PyTorch "undefined symbol" torchvision/torch ABI mismatch in CI?

There are 2 fixes depending on which cause you have: install torch and torchvision as a matched set and reinstall both cleanly to avoid a half upgrade. Work through them in order, since the first is the most common.

### What does PyTorch "undefined symbol" torchvision/torch ABI mismatch in CI actually mean?

Importing torchvision raises "ImportError: ...

### How do I stop PyTorch "undefined symbol" torchvision/torch ABI mismatch in CI happening again?

Always upgrade torch and torchvision/torchaudio together. The prevention section lists 3 changes that keep it from recurring.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
