tox-dev / pipdeptree

A command line utility to display dependency tree of the installed Python packages

Home Page:https://pypi.python.org/pypi/pipdeptree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid version: '1.1build1' (package: distro-info)

FallenKhadgar opened this issue · comments

$ pipdeptree --version
2.7.1
$ python3 --version
Python 3.10.10
$ uname -a   # Ubuntu 22.04.2 LTS
Linux u 5.15.0-69-generic #76-Ubuntu SMP Fri Mar 17 17:19:29 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$ pipdeptree -r   # same result for "pipdeptree -rp distro-info"
Traceback (most recent call last):
  File "/home/u/.local/bin/pipdeptree", line 8, in <module>
    sys.exit(main())
  File "/home/u/.local/lib/python3.10/site-packages/pipdeptree/__init__.py", line 988, in main
    tree = tree.reverse()
  File "/home/u/.local/lib/python3.10/site-packages/pipdeptree/__init__.py", line 406, in reverse
    m[k.as_requirement()] = []
  File "/home/u/.local/lib/python3.10/site-packages/pipdeptree/__init__.py", line 164, in as_requirement
    return ReqPackage(self._obj.as_requirement(), dist=self)
  File "/home/u/.local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2918, in as_requirement
    if isinstance(self.parsed_version, packaging.version.Version):
  File "/home/u/.local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2734, in parsed_version
    raise packaging.version.InvalidVersion(f"{str(ex)} {info}") from None
pip._vendor.packaging.version.InvalidVersion: Invalid version: '1.1build1' (package: distro-info)
$ pipdeptree --json-tree -p distro-info
[
    {
        "key": "distro-info",
        "package_name": "distro-info",
        "installed_version": "1.1build1",
        "required_version": "1.1build1",
        "dependencies": []
    }
]

Package: https://launchpad.net/ubuntu/+source/distro-info/1.1build1

That is an invalid version and not much we can do about it 🤔

Getting the same issue with devscripts:

Invalid version: '2.22.1ubuntu1' (package: devscripts)

I can't even target specific packages using pipdeptree -r -p <pkg>...

Full traceback:


Traceback (most recent call last):
  File "/home/dbelopopsky/.local/bin/pipdeptree", line 8, in <module>
    sys.exit(main())
  File "/home/dbelopopsky/.local/lib/python3.10/site-packages/pipdeptree/__init__.py", line 988, in main
    tree = tree.reverse()
  File "/home/dbelopopsky/.local/lib/python3.10/site-packages/pipdeptree/__init__.py", line 406, in reverse
    m[k.as_requirement()] = []
  File "/home/dbelopopsky/.local/lib/python3.10/site-packages/pipdeptree/__init__.py", line 164, in as_requirement
    return ReqPackage(self._obj.as_requirement(), dist=self)
  File "/home/dbelopopsky/.local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2918, in as_requirement
    if isinstance(self.parsed_version, packaging.version.Version):
  File "/home/dbelopopsky/.local/lib/python3.10/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2734, in parsed_version
    raise packaging.version.InvalidVersion(f"{str(ex)} {info}") from None
pip._vendor.packaging.version.InvalidVersion: Invalid version: '2.22.1ubuntu1' (package: devscripts)

Perhaps packages with an invalid versions could be skipped with a warning?

Perhaps Ubuntu could use valid python versions instead?

Perhaps Ubuntu could use valid python versions instead?

The progress on this can be tracked here.