Incompatibility with packaging>=22.0: cannot import name 'LegacyVersion' from 'packaging.version'
See original GitHub issueBug description
pip-audit is incompatible with latest version of packaging
, due to removed LegacyVersion
Reproduction steps
pip install pip-audit
- Check that
packaging
version is >= 22.0 - 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
orpython3 -V
): 3.9.15 pip
version (pip -V
orpip3 -V
): 22.0.4
Issue Analytics
- State:
- Created 9 months ago
- Comments:15 (10 by maintainers)
Top Results From Across the Web
Error while using kats module packaging version has no ...
Yesterday I used Kats for the first time and I had the same problem. Reason: The new version of the package packaging (22.0)...
Read more >packaging no version #4 - facebookresearch/TorchRay - GitHub
... 0.3.0 when running the example code, there is an error: from packaging import version ImportError: cannot import name 'version'
Read more >How to use the packaging.version.LegacyVersion function in ...
To help you get started, we've selected a few packaging.version.LegacyVersion examples, based on popular ways it is used in public projects.
Read more >Python pip3 won't install anything due to import errors ...
Following that thread, I deleted the ~/.local version of python's "Packaging" folder to no avail, and the only Python packages that were ...
Read more >no module named packaging.version - pip - Ask Ubuntu
I solved the above problem by installing pip by the following command python -m pip install -U pip. Now pip is working fine.....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Cut as 2.4.9. Thanks again!
Got it, thanks for explaining! In that case we can push another patch out; I’ll do that in a moment.