pipdeptree icon indicating copy to clipboard operation
pipdeptree copied to clipboard

handling of extra_requires

Open anntzer opened this issue 8 years ago • 5 comments

scikit-image (https://pypi.python.org/pypi/scikit-image) depends on dask[array] (https://pypi.python.org/pypi/dask) (not visible on PyPI but this can be checked by installing in a clean venv). dask[array] itself depends on toolz and numpy. pipdeptree does not realize this and considers toolz and numpy to not be dependents of anything after a clean install of scikit-image.

anntzer avatar Jun 16 '16 05:06 anntzer

Sorry for replying so late, I missed this issue somehow. What do you mean by "not visible on PyPI"? pipdeptree internally calls functions in the pip and pkg_resources modules. Hence it can only identify dependencies that pip can.

naiquevin avatar Oct 23 '16 10:10 naiquevin

PyPI shows the line

Requires matplotlib (>= 1.3.1), numpy (>= 1.7.2), scipy (>= 0.9.0), six (>= 1.7.3), networkx (>= 1.8), pillow (>= 2.1.0), dask (>= 0.5.0)

This dependency is visible at /usr/lib/python3.5/site-packages/scikit_image-0.12.3-py3.5.egg-info/requires.txt (or the equivalent on your OS), which contains the lines

six>=1.7.3
networkx>=1.8
pillow>=2.1.0
dask[array]>=0.5.0

pip does know about the dependency (well, it's able to resolve it...) but I'm not sure pip or pkg_resources expose it though...

anntzer avatar Oct 23 '16 16:10 anntzer

Ok. I'll have a look at it. Thanks.

naiquevin avatar Oct 24 '16 06:10 naiquevin

Looks like this is the same as pypa/pipenv#1013 See there for additional detail.

OrangeDog avatar May 14 '18 15:05 OrangeDog

Looks like this is the same as pypa/pipenv#1013 See there for additional detail.

For future reference:

  • This pipdeptree issue is not duplicated by that pipenv issue.
  • The pipenv issue depends on this pipdeptree issue to solve the pipenv issue since pipenv depends on pipdeptree. (the pipenv issue is closed as "out of scope").

joar avatar Sep 19 '18 11:09 joar

This should be no longer the case.

gaborbernat avatar Sep 06 '22 07:09 gaborbernat

Hi, unfortunately, this seems to still be a problem.

To replicate this, I created a fresh virtualenv with just pipdeptree and django-import-export 3.2.0

django-import-export==3.2.0 depends on tablib[html,ods,xls,xlsx,yaml]>=3.4.0 in it's install_requires tablib==3.5.0 depends on the following:

[project.optional-dependencies]
all = [
    "markuppy",
    "odfpy",
    "openpyxl>=2.6.0",
    "pandas",
    "pyyaml",
    "tabulate",
    "xlrd",
    "xlwt",
]
cli = ["tabulate"]
html = ["markuppy"]
ods = ["odfpy"]
pandas = ["pandas"]
xls = ["xlrd", "xlwt"]
xlsx = ["openpyxl>=2.6.0"]
yaml = ["pyyaml"]

Which can be seen in tablib-3.5.0-py3-none-any.whl/tablib-3.5.0.dist-info/METADATA as the following lines:

Provides-Extra: all
Requires-Dist: markuppy ; extra == 'all'
Requires-Dist: odfpy ; extra == 'all'
Requires-Dist: openpyxl (>=2.6.0) ; extra == 'all'
Requires-Dist: pandas ; extra == 'all'
Requires-Dist: pyyaml ; extra == 'all'
Requires-Dist: tabulate ; extra == 'all'
Requires-Dist: xlrd ; extra == 'all'
Requires-Dist: xlwt ; extra == 'all'
Provides-Extra: cli
Requires-Dist: tabulate ; extra == 'cli'
Provides-Extra: html
Requires-Dist: markuppy ; extra == 'html'
Provides-Extra: ods
Requires-Dist: odfpy ; extra == 'ods'
Provides-Extra: pandas
Requires-Dist: pandas ; extra == 'pandas'
Provides-Extra: xls
Requires-Dist: xlrd ; extra == 'xls'
Requires-Dist: xlwt ; extra == 'xls'
Provides-Extra: xlsx
Requires-Dist: openpyxl (>=2.6.0) ; extra == 'xlsx'
Provides-Extra: yaml
Requires-Dist: pyyaml ; extra == 'yaml'
Unfortunately, pipdeptree appears to be unable to find the dependency between `tablib` and it's optional dependencies

This is my pip freeze output:

(.venv) C:\Users\JayTurner\Desktop> pip freeze
asgiref==3.7.2
defusedxml==0.7.1
diff-match-patch==20230430
Django==4.2.7
django-import-export==3.2.0
et-xmlfile==1.1.0
MarkupPy==1.14
odfpy==1.4.1
openpyxl==3.1.2
pipdeptree==2.13.0
PyYAML==6.0.1
sqlparse==0.4.4
tablib==3.5.0
tzdata==2023.3
xlrd==2.0.1
xlwt==1.3.0

This is my pipdeptree output:

(.venv) C:\Users\JayTurner\Desktop> pipdeptree
django-import-export==3.2.0
├── diff-match-patch [required: Any, installed: 20230430]
├── Django [required: >=3.2, installed: 4.2.7]
│   ├── asgiref [required: >=3.6.0,<4, installed: 3.7.2]
│   ├── sqlparse [required: >=0.3.1, installed: 0.4.4]
│   └── tzdata [required: Any, installed: 2023.3]
└── tablib [required: >=3.4.0, installed: 3.5.0]
MarkupPy==1.14
odfpy==1.4.1
└── defusedxml [required: Any, installed: 0.7.1]
openpyxl==3.1.2
└── et-xmlfile [required: Any, installed: 1.1.0]
pip==23.2.1
pipdeptree==2.13.0
PyYAML==6.0.1
setuptools==65.5.0
xlrd==2.0.1
xlwt==1.3.0

I have also tried on pipdeptree 2.3.0, 2.3.1 and 2.3.2, which were the releases just before, just after and a bit after your comment on September 6th, 2022, none of which seem to work as expected.

TurnrDev avatar Nov 07 '23 13:11 TurnrDev

Interestingly, pipdeptree[test]'s own dependencies don't show as related to pipdeptree. Perhaps that might be an easy way to test that functionality is working.

TurnrDev avatar Nov 07 '23 13:11 TurnrDev

I see this might be related to https://github.com/tox-dev/pipdeptree/issues/107 too

TurnrDev avatar Nov 07 '23 13:11 TurnrDev

I see it's due to lack of resources. I won't bother you no more!

TurnrDev avatar Nov 07 '23 13:11 TurnrDev

PR welcome 🤗

gaborbernat avatar Nov 07 '23 15:11 gaborbernat

I'll see what I can do, but no promises ☺️

TurnrDev avatar Nov 07 '23 23:11 TurnrDev