Help with some use cases #374
-
I am creating a package and before packaging, I want to see the dependency tree using pipdeptree. How to go about it? From pip list ** from pipdeptree**
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
This will grab all the package metadata from your system environment and render it as text (as that is the default rendering option). If you want to just see your package in the result, you can pass the
This is because when pipdeptree detects it as a dependency, it will only be included as part of that package's dependencies (so not as a top-level package). We can see this in your output e.g.: matplotlib==3.8.3
├── contourpy [required: >=1.0.1, installed: 1.2.0]
│ └── numpy [required: >=1.20,<2.0, installed: 1.26.4] # <--- Here
├── cycler [required: >=0.10, installed: 0.12.1]
├── fonttools [required: >=4.22.0, installed: 4.49.0]
├── kiwisolver [required: >=1.3.1, installed: 1.4.5]
├── numpy [required: >=1.21,<2, installed: 1.26.4] # <-- Here
├── packaging [required: >=20.0, installed: 23.2]
├── pillow [required: >=8, installed: 10.2.0]
├── pyparsing [required: >=2.3.1, installed: 3.1.1]
└── python-dateutil [required: >=2.7, installed: 2.8.2]
└── six [required: >=1.5, installed: 1.16.0] If you want to see |
Beta Was this translation helpful? Give feedback.
-
@kemzeb thanks for clarifying. I am developing and testing a package right now (not yet packaged). I include in scripts by doing the following. How do I display mmpl's dependencies?
|
Beta Was this translation helpful? Give feedback.
From looking at your code snippet, it looks like you are modifying
sys.path
during runtime in order for the importing mechanism to be able to findmmpl
. More importantly, it seems thatmmpl
is not already available in your environment.One approach to see
mmpl
deps is to use Python's $PYTHONPATH environment variable like:PYTHONPATH="C:\Users\Documents\noc\mmpl" pipdeptree -p mmpl
Note that pipdeptree analyzes the package metadata. So if
mmpl
doesn't have a metadata directory or your path doesn't point to a directory that containsmmpl
's metadata directory, it cannot be displayed.