# packaging.version.InvalidVersion: Invalid version: '1.0.0-rc.1+build.5.6.7.8.9.10'

- **ID:** `python/pip-version-parse-invalid-version`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A package version string does not conform to PEP 440. This often happens with custom-built or vendored packages whose version was set from a git describe or CI variable containing invalid characters.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## Workarounds

1. **** (80% success)
   ```
   from packaging.version import Version, InvalidVersion

def normalize(v):
    try:
        return str(Version(v))
    except InvalidVersion:
        return v.replace('-rc.', 'rc').replace('+', '.post')

print(normalize('1.0.0-rc.1'))  # 1.0.0rc1
   ```
2. **** (85% success)
   ```
   # in setup.py
from setuptools import setup
setup(name='mypkg', version='1.0.0rc1')  # not 1.0.0-rc.1
   ```

## Dead Ends

- **** — Pre-release flag doesn't relax PEP 440 validation; the version string is still invalid. (90% fail)
- **** — Ignoring installed packages doesn't change version parsing. (85% fail)
