question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incompatibility with packaging>=22.0: cannot import name 'LegacyVersion' from 'packaging.version'

See original GitHub issue

Bug description

pip-audit is incompatible with latest version of packaging, due to removed LegacyVersion

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

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
woodruffwcommented, Dec 14, 2022

Cut as 2.4.9. Thanks again!

1reaction
woodruffwcommented, Dec 14, 2022

Got it, thanks for explaining! In that case we can push another patch out; I’ll do that in a moment.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found