# ImportError: cannot import name '_imaging' from 'PIL' (PIL is required for image saving)

- **ID:** `python/matplotlib-agg-pillow-missing`
- **Domain:** python
- **Category:** install_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Pillow is not installed or a broken partial install exists, so matplotlib cannot save PNG/JPEG via the Agg backend.

## Version Compatibility

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

## Workarounds

1. **** (94% success)
   ```
   pip uninstall -y PIL Pillow
pip install --no-cache-dir Pillow
   ```
2. **** (90% success)
   ```
   fig.savefig('out.pdf')  # or 'out.svg'
   ```

## Dead Ends

- **** — The 'PIL' package on PyPI is a stub that raises an error; the correct package is Pillow. (95% fail)
- **** — Import order does not fix a broken _imaging C extension. (85% fail)
