Incompatibility with packaging>=22.0: cannot import name 'LegacyVersion' from 'packaging.version'
envgap__pypa__pip-audit-426
01 / FAILURE SIGNATURE
As reported upstream
ImportError: cannot import name 'LegacyVersion' from 'packaging.version' (/usr/local/lib/python3.9/site-packages/packaging/version.py)
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
6e9b0c49e6aa0d5d44b7dc122ff65576d2460dee- Manifest
pyproject.toml- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
pypa/pip-audit #426 · read the original issue
## Bug description
pip-audit is incompatible with latest version of `packaging`, due to [removed `LegacyVersion` ](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst#220---2022-12-07)
## Reproduction steps
1. `pip install pip-audit`
2. Check that `packaging` version is >= 22.0
3. Run `pip freeze | pip-audit --no-deps -r -` to check the currently installed packages
## Expected behavior
`pip-audit` installs a compatible version of `packaging`
## Screenshots and logs
```
Traceback (most recent call last):
File "/usr/local/bin/pip-audit", line 5, in <module>
from pip_audit._cli import audit
File "/usr/local/lib/python3.9/site-packages/pip_audit/_cli.py", line 17, in <module>
from pip_audit._audit import AuditOptions, Auditor
File "/usr/local/lib/python3.9/site-packages/pip_audit/_audit.py", line 10, in <module>
from pip_audit._dependency_source import DependencySource
File "/usr/local/lib/python3.9/site-packages/pip_audit/_dependency_source/__init__.py", line 14, in <module>
from .requirement import RequirementSource
File "/usr/local/lib/python3.9/site-packages/pip_audit/_dependency_source/requirement.py", line 19, in <module>
from pip_requirements_parser import InstallRequirement, InvalidRequirementLine, RequirementsFile
File "/usr/local/lib/python3.9/site-packages/pip_requirements_parser.py", line 73, in <module>
from packaging.version import LegacyVersion
ImportError: cannot import name 'LegacyVersion' from 'packaging.version' (/usr/local/lib/python3.9/site-packages/packaging/version.py)
```
## Platform information
* OS name and version: docker, python:3.9-alpine
* `pip-audit` version (`pip-audit -V`): 2.4.7
* Python version (`python -V` or `python3 -V`): 3.9.15
* `pip` version (`pip -V` or `pip3 -V`): 22.0.4
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]