tox-dev / pipdeptree

A command line utility to display dependency tree of the installed Python packages
https://pypi.python.org/pypi/pipdeptree
MIT License
2.73k stars 147 forks source link

Several package missing from the output #322

Closed lamyergeier closed 4 months ago

lamyergeier commented 4 months ago

I have several installed packages as follows but pipdeptree just show 4 ! What should I do to show the dependency tree for all global installed packages?

$ pip list
Package                  Version
------------------------ ----------
aiohttp                  3.9.3
aiosignal                1.3.1
argcomplete              3.2.2
async-timeout            4.0.3
attrs                    23.2.0
beautifulsoup4           4.12.3
blinker                  1.7.0
calplot                  0.1.7.5
certifi                  2024.2.2
cffi                     1.16.0
charset-normalizer       3.3.2
click                    8.1.7
cmake                    3.28.3
contourpy                1.2.0
ctranslate2              4.0.0
cycler                   0.12.1
docopt                   0.6.2
docutils                 0.20.1
emoji                    2.10.1
filelock                 3.13.1
fonttools                4.49.0
frozenlist               1.4.1
fsspec                   2024.2.0
idna                     3.6
imageio                  2.34.0
itsdangerous             2.1.2
Jinja2                   3.1.3
joblib                   1.3.2
kiwisolver               1.4.5
lazy_loader              0.3
libxml2-python           2.12.5
lit                      17.0.6
MarkupSafe               2.1.5
matplotlib               3.8.3
meson                    1.3.2
mpmath                   1.3.0
multidict                6.0.5
networkx                 3.2.1
numpy                    1.26.4
nvidia-cublas-cu12       12.3.4.1
nvidia-cuda-cupti-cu12   12.3.101
nvidia-cuda-nvrtc-cu12   12.3.107
nvidia-cuda-runtime-cu12 12.3.101
nvidia-cudnn-cu12        8.9.7.29
nvidia-cufft-cu12        11.0.12.1
nvidia-curand-cu12       10.3.4.107
nvidia-cusolver-cu12     11.5.4.101
nvidia-cusparse-cu12     12.2.0.103
nvidia-nccl-cu12         2.19.3
nvidia-nvjitlink-cu12    12.3.101
nvidia-nvtx-cu12         12.3.101
packaging                23.2
pandas                   2.2.1
pandoc-xnos              2.5.0
pandocfilters            1.5.1
pillow                   10.2.0
pip                      24.0
platformdirs             4.2.0
plotly                   5.19.0
protobuf                 4.25.3
psutil                   5.9.8
pycparser                2.21
Pygments                 2.17.2
pyparsing                3.1.1
PyQt5                    5.15.10
PyQt5-Qt5                5.15.2
PyQt5-sip                12.13.0
python-dateutil          2.8.2
pytz                     2024.1
PyWavelets               1.5.0
PyYAML                   6.0.1
regex                    2023.12.25
requests                 2.31.0
sacremoses               0.1.1
scikit-image             0.22.0
scipy                    1.12.0
sentencepiece            0.2.0
setuptools               69.1.1
shapely                  2.0.3
six                      1.16.0
soupsieve                2.5
srt                      3.5.3
stanza                   1.7.0
sympy                    1.12
tenacity                 8.2.3
tifffile                 2024.2.12
toml                     0.10.2
torch                    2.2.1
tqdm                     4.66.2
triton                   2.2.0
typing_extensions        4.9.0
tzdata                   2024.1
unmap                    0.1.2
urllib3                  2.2.1
userpath                 1.9.1
vosk                     0.3.45
websockets               12.0
Werkzeug                 3.0.1
wheel                    0.42.0
xarray                   2024.2.0
xxhash                   3.4.1
yarl                     1.9.4
zmapio                   0.8.1
$ pipdeptree
pip==24.0
pipdeptree==2.14.0
setuptools==69.0.2
wheel==0.42.0
kemzeb commented 4 months ago

Are you running pipdeptree in a virtual environment? There has been problems associated with it discussed in #130. If so, you could try the workaround they have there.

lamyergeier commented 4 months ago

No I am using in default bash without any virtual environments. But I have installed several packages using pipx that uses virtual environments. So is that the reason? I guess pipx should not affect this as it installs every package in its own virtual environment. isn't it?

$ pipx list
venvs are in /mnt/Data/.local/pipx/venvs
apps are exposed on your $PATH at /mnt/Data/.local/bin
manual pages are exposed at /mnt/Data/.local/share/man
   package argostranslate 1.9.1, installed using Python 3.11.6
    - argos-translate
    - argos-translate-gui
    - argospm
    - libretranslate
    - ltmanage
   package baca 0.1.16, installed using Python 3.11.3
    - baca
   package backgroundremover 0.2.6, installed using Python 3.11.3
    - backgroundremover
   package beets 1.6.0, installed using Python 3.11.6
    - beet
    - flask
   package betteradbsync 1.4.0, installed using Python 3.11.6
    - adbsync
   package borgbackup 2.0.0b7, installed using Python 3.11.7
    - borg
    - borgfs
   package borgmatic 1.8.8, installed using Python 3.12.1
    - borgmatic
    - generate-borgmatic-config
    - upgrade-borgmatic-config
    - validate-borgmatic-config
   package brotab 1.4.2, installed using Python 3.11.3
    - brotab
    - bt
    - bt_mediator
   package deskew 1.5.1, installed using Python 3.11.7
    - deskew
   package easyocr 1.7.1, installed using Python 3.12.1
    - easyocr
   package git-cola 4.5.0, installed using Python 3.11.5
    - cola
    - git-cola
    - git-cola-sequence-editor
    - git-dag
   package gnome-extensions-cli 0.10.1, installed using Python 3.11.3
    - gext
    - gnome-extensions-cli
   package gtts 2.5.1, installed using Python 3.11.6
    - gtts-cli
   package johnnydep 1.20.4, installed using Python 3.11.7
    - johnnydep
    - pipper
   package jrnl 4.1, installed using Python 3.11.3
    - jrnl
   package jupyterlab 4.1.1, installed using Python 3.11.3
    - jlpm
    - jupyter-lab
    - jupyter-labextension
    - jupyter-labhub
   package jupytex 0.0.3, installed using Python 3.11.3
    - jupytex
   package jupytext 1.16.1, installed using Python 3.11.6
    - jupytext
    - jupytext-config
   package lastversion 3.5.0, installed using Python 3.11.6
    - lastversion
   package ocrmypdf 16.1.1, installed using Python 3.11.3
    - ocrmypdf
   package pandoc-eqnos 2.5.0, installed using Python 3.11.3
    - pandoc-eqnos
   package pandoc-fignos 2.4.0, installed using Python 3.11.3
    - pandoc-fignos
   package pandoc-tablenos 2.3.0, installed using Python 3.11.3
    - pandoc-tablenos
   package par2deep 1.10.1, installed using Python 3.11.7
    - par2deep
    - par2deep-cli
   package pdf-tocgen 1.3.4, installed using Python 3.11.3
    - pdftocgen
    - pdftocio
    - pdfxmeta
   package pipdeptree 2.14.0, installed using Python 3.11.6
    - pipdeptree
   package piper-tts 1.2.0, installed using Python 3.11.7
    - piper
   package pylint 3.0.3, installed using Python 3.11.3
    - epylint
    - pylint
    - pylint-config
    - pyreverse
    - symilar
   package termgraph 0.5.3, installed using Python 3.11.3
    - termgraph
   package visidata 3.0.2, installed using Python 3.11.3
    - vd
    - vd2to3.vdx
    - vgit
    - visidata
    - man1/vd.1
    - man1/visidata.1
   package vorta 0.9.1, installed using Python 3.12.1
    - vorta
   package yamllint 1.35.1, installed using Python 3.11.3
    - yamllint
   package yapf 0.40.2, installed using Python 3.11.3
    - yapf
    - yapf-diff
   package yark 1.2.10, installed using Python 3.11.3
    - yark
kemzeb commented 4 months ago

I never used pipx before, but from tinkering with it for a little bit I think you maybe correct. It looks like pip does not know of any packages installed by pipx (I assume because it does not look at pipx's "venvs" path (e.g. /usr/local/py-utils/venvs).

I also see you installed pipdeptree using pipx, and when I ran it I gotten a similar output to yours:

$ /usr/local/py-utils/bin/pipdeptree # Using this pipx path because I have pipdeptree installed locally
pip==24.0
pipdeptree==2.15.1
setuptools==56.0.0

From reading the docs, it seems that it creates a virtual environment for every package. We do use pip's internal API to fetch all the packages from the environment, so my best guess (as you mentioned) is that pipdpetree is in its own virtual environment and it does not have access to the global packages.