Hi all, I’m having some issues with a dependency (...
# general
d
Hi all, I’m having some issues with a dependency (
numpy
) being included in my final
pex_binary
that isn’t listed in my targets dependencies
Copy code
$ pants --no-pantsd dependencies --transitive services/launch_dashboard:gunicorn
But is included in the final build
Copy code
$ pants --no-pantsd repl services/launch_dashboard:gunicorn
>>> import numpy
>>> ???
More evidence
Copy code
$ pants package services/launch_dashboard:gunicorn
unzip -l dist/services.launch_dashboard/gunicorn.pex | grep numpy -c
991
Doing a
pants dependents //:root#numpy
shows a few dependees of
numpy
, but none of these are consumed by the target I’m building
Copy code
$ pants dependents //:root#numpy
//:root
multiply/advice/simulators/premiums/premiums.py
multiply/advice/tests/helpers.py
multiply/advice_launch/pension/annuity.py
Any ideas/tips for how I can dig a little deeper to determine why this dep is being included?
1
f
Maybe try
pants paths
to see the dependency path between the
pex_binary
and the
numpy
requirement? Try
pants paths --from=services/launch_dashboard:gunicorn --to=//:root#numpy
b
The
--transitive
flag is handy, e.g.
pants dependents --transitive //:root#numpy
But... if numpy is only pulled in as a transitive dependency of a third party package (rather than your own code), this isn't currently visible to pants' introspection goals: https://github.com/pantsbuild/pants/issues/12733 If that's the case, you might have to do something like
pants dependencies --transitive services/launch_dashboard:gunicorn | grep '//:root#'
to find the direct third-party deps and then work out which of those includes numpy
d
Aha I wasn’t aware it didn’t include transitive dependencies of third party packages, that explains it I took the root requirements and stuck them in a new requirements.txt, installed this and debugged why stuff was included with
pip show <dep>
It’s a dependency of a dependency of a dependency. Thanks both for the help.
👍 1