blue-city-97042
09/12/2023, 11:55 PMallennlp==0.9.0
-- thinc==7.1.0 (source only)
-- numpy>1.20.0
The problem we are running into is that when we do a generate-lockfile
the thinc
library (which is a source distribution) builds itself using the numpy 1.25.1
which is incompatible (by requiring a minimum python version of 3.9) with our targeted python runtime (3.8.16). Using a constraint only works for the top level dependencies being brought in. The moment a source distribution is brought in, a subprocess is started to to do the build which does not honor a constraint file from the parent process (top level). BUT Instead you have to declare a PIP_CONSTRAINT environment variable and this will get passed to the subprocess runtimes and use the constraints. Hence we would like to use a docker_environment to generate the lockfile. This would allow us to ensure that our dependencies only include libraries for the x86 64 Linux platform. A lot of these issues are specifically due to pip non allowing subprocess arguments, but by virtue of pants using pip here we are 😞broad-processor-92400
09/13/2023, 12:13 AMpants.toml
(and elsewhere)? Theoretically, Pants/PEX should understand that, for instance, you're using 3.8 and choose appropriate dependencies based on that.blue-city-97042
09/13/2023, 12:18 AMblue-city-97042
09/13/2023, 12:19 AMbroad-processor-92400
09/13/2023, 12:19 AMblue-city-97042
09/13/2023, 12:20 AMblue-city-97042
09/13/2023, 12:21 AMbroad-processor-92400
09/13/2023, 12:22 AMblue-city-97042
09/13/2023, 12:23 AM[GLOBAL]
pants_version = "2.16.0"
pants_workdir = "%(buildroot)s/build/.pants.d"
pants_subprocessdir= "%(buildroot)s/build/.pids"
local_store_dir = "%(buildroot)s/build/lmdb_store"
named_caches_dir = "%(buildroot)s/build/named_caches"
backend_packages = [
"pants.backend.python",
"pants.backend.shell",
"pants.backend.docker"
]
[source]
root_patterns = [
"/support/*",
"/try"
]
[python]
interpreter_constraints = [ "==3.8.*" ]
resolves = { try = "try/try.lock" }
resolves_to_constraints_file = { try = "try/constraints.txt" }
resolves_to_interpreter_constraints = { try = ["==3.8.*"] }
enable_resolves = true
[environments-preview.names]
python38_builder = "support/allen-srl-deps:python38_builder"
srl_generate_lockfile = "try:srl_generate_lockfile"
[anonymous-telemetry]
enabled = false
broad-processor-92400
09/13/2023, 12:36 AMpython_version >= 3.9
constraint in Numpy 1.25 doesn't do what I expected, and/or the 2.16 version of Pants (and PEX) doesn't read it. Sorry.
I reduced the example and reproduced the behaviour on my mac: https://gist.github.com/huonw/540f0a1acd9495737a186cf7c34e7376
I tried upgrading that example to pants 2.17 and pants generate-lockfiles
seems to work (even without constraints files or the numpy
python_requirement
, both which failed in 2.16). This suggests to me three options to investigate:
1. upgrade to 2.17
2. remain on 2.16, and see if upgrading PEX resolves it: (you can apply the [pex-cli].version
and known_version
settings from 2.17 to help https://www.pantsbuild.org/docs/reference-pex-cli#known_versions)
3. remain on 2.16/default PEX and see if using a newer pip_version helps: https://www.pantsbuild.org/v2.16/docs/reference-python#pip_versionblue-city-97042
09/13/2023, 12:37 AMblue-city-97042
09/13/2023, 12:37 AMenough-analyst-54434
09/13/2023, 1:10 AM3.11.*
lock just fine. So I wanted to clear up that apparent misunderstanding.enough-analyst-54434
09/13/2023, 1:11 AMenough-analyst-54434
09/13/2023, 1:12 AMenough-analyst-54434
09/13/2023, 1:16 AMenough-analyst-54434
09/13/2023, 1:23 AMenough-analyst-54434
09/13/2023, 1:23 AMenough-analyst-54434
09/13/2023, 1:24 AMenough-analyst-54434
09/13/2023, 1:26 AMenough-analyst-54434
09/13/2023, 1:28 AMblue-city-97042
09/13/2023, 2:58 PMblue-city-97042
09/13/2023, 2:59 PMenough-analyst-54434
09/13/2023, 5:07 PMblue-city-97042
09/13/2023, 5:19 PM