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

Depend on pip

pawamoy opened this issue · comments

pipdeptree depends on pip:

Traceback (most recent call last):
  File "/media/data/dev/markdown-exec/.venv/bin/pipdeptree", line 5, in <module>
    from pipdeptree.__main__ import main
  File "/media/data/dev/markdown-exec/.venv/lib/python3.11/site-packages/pipdeptree/__main__.py", line 10, in <module>
    from pipdeptree._models import PackageDAG
  File "/media/data/dev/markdown-exec/.venv/lib/python3.11/site-packages/pipdeptree/_models/__init__.py", line 3, in <module>
    from .dag import PackageDAG, ReversedPackageDAG
  File "/media/data/dev/markdown-exec/.venv/lib/python3.11/site-packages/pipdeptree/_models/dag.py", line 12, in <module>
    from .package import DistPackage, ReqPackage, pep503_normalize
  File "/media/data/dev/markdown-exec/.venv/lib/python3.11/site-packages/pipdeptree/_models/package.py", line 10, in <module>
    from pip._vendor.pkg_resources import Requirement  # noqa: PLC2701
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'pip'

...so I would suggest to add pip as a dependency, in pyproject.toml. It is less and less common to have pip automatically installed in virtualenvs, so this shouldn't be expected anymore that pip is always installed alongside a package 🙂 Happy to send a PR!

Related: #331

By the way it might even be possible to get rid of the dependency on pip and its internals. I see two places where pip vendored packages are used:

Sorry if this has already been discussed, I couldn't find a relevant discussion 🙂

EDIT: ah, relevant PR: #333

Seems reasonable enough; feel free to open a PR!

Opened a PR to lax up the pip version range to support use case of using pipdeptree to revive projects stuck on ancient versions of pip 👍 #340