How do I get the tree of python versions that pant...
# general
n
How do I get the tree of python versions that pants is building when it tries to evaluate a target? We have a static requirements.txt and constraints.txt file. I want to bump the version of jsonschema, so I've updated the pinned version appropriately. When running some apps I now get an error like this
Copy code
ERROR: Cannot install jsonschema==4.19.1 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit <https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts>

 The conflict is caused by:
     The user requested jsonschema==4.19.1
     The user requested (constraint) jsonschema==4.23.0
jsonschema==4.19.1
is listed in the versions that Pants has found to install. But it's not found at all in my constraints or requirements files. So it must be coming from one of the dependencies of the app. I can run
pants dependencies --dependencies-transitive {target}
but that only tells me the named dependencies of the different services and libraries
Copy code
...
requirements/python#PyYAML
requirements/python#aiohttp
requirements/python#aiohttp-socks
requirements/python#boto3
requirements/python#boto3-stubs
requirements/python#colorama
requirements/python#cryptography
...
How can I get the actual versions of real packages that are going to get installed? Ideally I want to see something like
requested foobar==1.2.3; depends on [jsonschema==4.19.1]
b
Are you using resolves with lockfiles? Sounds like you might need to re-generate the lockfiles.
Copy code
pants generate-lockfiles
https://www.pantsbuild.org/2.24/docs/python/overview/lockfiles
n
we're on 2.22. we're using
requirement_constraints
instead of
enable_resolves
but even if we swap, that doesn't answer my question, which is If there's a conflict, how do we assess where the two conflicting packages are coming from?
g
Dropping down to pex CLI is probably the easiest route, since Pants uses Pex for a lot of the heavy lifting here. I'd start by trying to just convert your existing reqs/constraints to a lockfile, and see if it barfs already there.
Copy code
pex3 lock create -r requirements.txt --constraints constraints.txt $$other_args_you_need