Hrm - I don't repro so I'll have you file if you d...
# general
e
Hrm - I don't repro so I'll have you file if you don't mind once you have a setup you like:
Copy code
$ cat BUILD.nate 
python_requirement_library(
    name="foo",
    requirements=["boto3==1.15.6", "botocore"],
)
$ ./pants repl //:foo
10:55:21.20 [WARN] The constraints file 3rdparty/python/constraints.txt does not contain entries for the following requirements: botocore, boto3
10:55:21.20 [WARN] Ignoring resolve_all_constraints setting in [python_setup] scope because constraints file does not cover all requirements.
10:56:23.37 [INFO] Completed: Building requirements.pex with 2 requirements: boto3==1.15.6, botocore
10:56:23.37 [ERROR] Exception caught: (pants.engine.internals.scheduler.ExecutionError)
...
pants.engine.process.ProcessExecutionFailure: Process 'Building requirements.pex with 2 requirements: boto3==1.15.6, botocore' failed with exit code 1.
stdout:

stderr:
ERROR: Cannot install botocore==1.18.10, botocore==1.18.11, botocore==1.18.12, botocore==1.18.13, botocore==1.18.14, botocore==1.18.15, botocore==1.18.16, botocore==1.18.17, botocore==1.18.18, botocore==1.18.6, botocore==1.18.7, botocore==1.18.8 and botocore==1.18.9 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit <https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies>
pid 152051 -> /usr/bin/python3.7 /home/jsirois/.cache/pants/named_caches/pex_root/pip.pex/1b2dfe434f773fd6aaf45cdd941bad0c262b8e13 --disable-pip-version-check --no-python-version-warning --exists-action a --isolated -q --cache-dir /home/jsirois/.cache/pants/named_caches/pex_root download --dest /tmp/process-executionYHMAYe/.tmp/tmp10y30qf9/usr.bin.python3.7 --constraint 3rdparty/python/constraints.txt boto3==1.15.6 botocore --index-url <https://pypi.org/simple/> --retries 5 --timeout 15 exited with 1 and STDERR:
None
At a baseline we should see the same error and we don't
h
Nit, would y'all mind moving this to a thread please? Keeps the channel a little more organized Also thank you John for looking into this!
h
yah i’ll submit a bug report
ah i see, so in the pants repo i commented out the constraints stuff to get around the error you got:
Copy code
diff --git i/pants.toml w/pants.toml
index d126e7465..704833905 100644
--- i/pants.toml
+++ w/pants.toml
@@ -60,8 +60,8 @@ root_patterns = [

 [python-setup]
 resolver_version = "pip-2020-resolver"
-requirement_constraints = "3rdparty/python/constraints.txt"
-resolve_all_constraints = "nondeployables"
+#requirement_constraints = "3rdparty/python/constraints.txt"
+#resolve_all_constraints = "nondeployables"
 interpreter_constraints = [">=3.7,<3.9"]

 [black]
To fix my error i had to change our interpreter_constraints. Due to our codebase still having some py2 code we still need to set a global interpreter_constraints to py2/py3. And apparently the pip resolver stuff doesn’t work when executing with py2, which pants chooses by default since it’s the min version.
if you temp patch pants.toml you’ll be able to repro:
Copy code
diff --git i/pants.toml w/pants.toml
index d126e7465..d90925960 100644
--- i/pants.toml
+++ w/pants.toml
@@ -60,9 +60,9 @@ root_patterns = [

 [python-setup]
 resolver_version = "pip-2020-resolver"
-requirement_constraints = "3rdparty/python/constraints.txt"
-resolve_all_constraints = "nondeployables"
-interpreter_constraints = [">=3.7,<3.9"]
+#requirement_constraints = "3rdparty/python/constraints.txt"
+#resolve_all_constraints = "nondeployables"
+interpreter_constraints = ["~=2.7", ">=3.7,<3.9"]

 [black]
 config = "pyproject.toml"
yup, able to repro with pex by setting the python to python2:
Copy code
$ pex --python-path=~/.pyenv/versions/2.7.17/bin boto3==1.15.6 botocore -o boto3.pex
Failed to resolve compatible distributions:
1: boto3==1.15.6 requires botocore<1.19.0,>=1.18.6 but botocore 1.19.56 was resolved
so i guess i should file a report in the pex repo?
or is this new resolver only available under py3 interpreters?
looks like --use-feature=2020-resolver works in pip 20.3.3 for python2, it’s just that pex is not passing that arg to the underlying pip call
however, looks like pip 21 will remove support for py2 entirely
e
Aha, ok. Thanks for digging. Yeah, if you can file the Pex issue that's an easy fix to get out with 2.1.25 this week.
And yes, Pip will drop support for 2.7. Pex will sometime later, but Pex pins its Pip dependency so can control this somewhat.
h
ok, i see the line of code, we could simply add
--use-feature=2020-resolver
to the PIP_2020 line here: https://github.com/pantsbuild/pex/blob/master/pex/pip.py#L45
it would cover both interpreter cases, however since pip defaults to 2020 resolver in py3, pip would emit a deprecation warning
e
IIRC it's not that simple and if you send it under 3 you get an error.
Ah, not error just warning:
Copy code
$ pip --use-feature=2020-resolver debug
WARNING: --use-feature=2020-resolver no longer has any effect, since it is now the default dependency resolver in pip. This will become an error in pip 21.0.
The warning is not displayed under Python 2.7 - just the
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. ...
warning. So warning squelching will be in order on top of the simple fix.
I can file the issue Nate - this is plenty of data.
h
oh ok, thx!
e