# ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running

- **ID:** `python/matplotlib-tkinter-not-available`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

matplotlib was configured to use TkAgg but the environment has no Tk installation or is running headless without DISPLAY.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   export MPLBACKEND=Agg
python your_script.py
   ```
2. **** (82% success)
   ```
   sudo apt-get install -y python3-tk tk-dev
# then run under a real X session or Xvfb:
xvfb-run -a python your_script.py
   ```

## Dead Ends

- **** — There is no such PyPI package; tkinter ships with the Python interpreter and needs the OS tk-dev package. (95% fail)
- **** — Reinforces the broken backend choice and fails again at import. (90% fail)
