Closed kaos closed 2 years ago
I repro.
A bit more compact, but the key relevant fact that's not explicit in both @kaos's case and mine is the IC is ">=3.8" and we both have 3.8 and 3.9 interpreters available on the PATH (I have 3.10 as well). As such, the step creating the PEX file should include a thrift distribution built for each applicable local interpreter but does not:
$ pex -V
2.1.73
$ pex3 -V
2.1.73
$ pex-tools -V
2.1.73
$ pex3 lock create thrift==0.15.0 --style universal --interpreter-constraint ">=3.8" --indent 2 -o 1688.lock.json
$ cat 1688.lock.json
{
"allow_builds": true,
"allow_prereleases": false,
"allow_wheels": true,
"build_isolation": true,
"constraints": [],
"locked_resolves": [
{
"locked_requirements": [
{
"artifacts": [
{
"algorithm": "sha256",
"hash": "8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254",
"url": "https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl"
},
{
"algorithm": "sha256",
"hash": "1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926",
"url": "https://files.pythonhosted.org/packages/71/39/171f1c67cd00715f190ba0b100d606d440a28c93c7714febeca8b79af85e/six-1.16.0.tar.gz"
}
],
"project_name": "six",
"requires_dists": [],
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7",
"version": "1.16"
},
{
"artifacts": [
{
"algorithm": "sha256",
"hash": "87c8205a71cf8bbb111cb99b1f7495070fbc9cabb671669568854210da5b3e29",
"url": "https://files.pythonhosted.org/packages/6e/97/a73a1a62f62375b21464fa45a0093ef0b653cb14f7599cffce35d51c9161/thrift-0.15.0.tar.gz"
}
],
"project_name": "thrift",
"requires_dists": [
"six>=1.7.2",
"tornado>=4.0; extra == \"all\"",
"tornado>=4.0; extra == \"tornado\"",
"twisted; extra == \"all\"",
"twisted; extra == \"twisted\""
],
"requires_python": null,
"version": "0.15"
}
],
"platform_tag": [
"cp310",
"cp310",
"manylinux_2_35_x86_64"
]
}
],
"pex_version": "2.1.73",
"prefer_older_binary": false,
"requirements": [
"thrift==0.15.0"
],
"requires_python": [
">=3.8"
],
"resolver_version": "pip-legacy-resolver",
"style": "universal",
"transitive": true,
"use_pep517": null
}
$ pex --interpreter-constraint ">=3.8" --lock 1688.lock.json -o 1688.pex
$ pex-tools 1688.pex info -i2
{
"bootstrap_hash": "f8bcf3f144c35d3dddd7655fde455ab26aba89d0",
"build_properties": {
"pex_version": "2.1.73"
},
"code_hash": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
"distributions": {
"six-1.16.0-py2.py3-none-any.whl": "3e1c439c88d2e7681372427bab751b3fc99969891e95a714fed9604bf7710213",
"thrift-0.15.0-cp38-cp38-linux_x86_64.whl": "132c47afddf05f70154b92dc4b086f870d75f078259779815def1e3a6feee8d0"
},
"emit_warnings": true,
"ignore_errors": false,
"includes_tools": false,
"inherit_path": "false",
"interpreter_constraints": [
">=3.8"
],
"pex_hash": "29d1af706b72978a7a314e59720c773dd6b1d0e6",
"pex_path": null,
"requirements": [
"thrift==0.15.0"
],
"strip_pex_env": true,
"venv": false,
"venv_bin_path": "false",
"venv_copies": false,
"venv_site_packages_copies": false,
"pex_root": "/home/jsirois/.pex"
}
$ python3.8 1688.pex -c 'import thrift; print(thrift.__file__)'
/home/jsirois/.pex/installed_wheels/4f1aefd59778dc830f0bbe8de3bf352aef10969f3ef112667606fa23c796f2ea/thrift-0.15.0-cp38-cp38-linux_x86_64.whl/thrift/__init__.py
$ python3.9 1688.pex -c 'import thrift; print(thrift.__file__)'
Traceback (most recent call last):
File "/home/jsirois/.pex/unzipped_pexes/29d1af706b72978a7a314e59720c773dd6b1d0e6/.bootstrap/pex/pex.py", line 483, in execute
self.activate()
File "/home/jsirois/.pex/unzipped_pexes/29d1af706b72978a7a314e59720c773dd6b1d0e6/.bootstrap/pex/pex.py", line 147, in activate
self._activated_dists = self._activate()
File "/home/jsirois/.pex/unzipped_pexes/29d1af706b72978a7a314e59720c773dd6b1d0e6/.bootstrap/pex/pex.py", line 134, in _activate
activated_dists.extend(env.activate())
File "/home/jsirois/.pex/unzipped_pexes/29d1af706b72978a7a314e59720c773dd6b1d0e6/.bootstrap/pex/environment.py", line 312, in activate
self._activated_dists = self._activate()
File "/home/jsirois/.pex/unzipped_pexes/29d1af706b72978a7a314e59720c773dd6b1d0e6/.bootstrap/pex/environment.py", line 661, in _activate
resolved = self.resolve()
File "/home/jsirois/.pex/unzipped_pexes/29d1af706b72978a7a314e59720c773dd6b1d0e6/.bootstrap/pex/environment.py", line 492, in resolve
for fingerprinted_distribution in self.resolve_dists(all_reqs)
File "/home/jsirois/.pex/unzipped_pexes/29d1af706b72978a7a314e59720c773dd6b1d0e6/.bootstrap/pex/environment.py", line 516, in resolve_dists
for qualified_req_or_not_found in self._root_requirements_iter(reqs):
File "/home/jsirois/.pex/unzipped_pexes/29d1af706b72978a7a314e59720c773dd6b1d0e6/.bootstrap/pex/environment.py", line 457, in _root_requirements_iter
raise ResolveError(message)
pex.environment.ResolveError: A distribution for thrift could not be resolved in this environment.Found 1 distribution for thrift that do not apply:
1.) The wheel tags for thrift 0.15.0 are cp38-cp38-linux_x86_64 which do not match the supported tags of /home/jsirois/.pyenv/versions/3.9.10/bin/python3.9:
cp39-cp39-manylinux_2_35_x86_64
...
py30-none-any
It looks like lock resolves break an assumption of the wheel builder infra. That infra is normally fed 1 set of artifacts per target (since pip download ...
is run once per target), but for a lock, all artifacts come centrally from a single multi-threaded download for all targets in ~/.pex/downloads
. Looks like a simple fix.
I've noticed issues with
thrift
(for unknown reasons) when Pants is creating a resolves pex file from a lock file. If I simply create a pex withthrift
as the only requirement, it works.Using
pex 2.1.73
I did notice that the fingerprint seems to be identical for all variants of thrift, in case that could cause issues... ? (Added related output log from pex at the end for this)
yields a
PEX-INFO
thus:Note that there is no
thrift
forcp38
here. (when running from the pants sandbox, I get the inverse, where thecp39
is missing instead. guessing it is the same issue only with some circumstances swapped)While
gives me:
With
thrift
for bothcp38
andcp39
.The
thrift
library itself is asdist
only.The (redacted)
pants.lock
file used above is: pants.lock-redacted.txtWhen running from the sandbox, pex outputs these lines mentioning
thrift
(and see for bothcp38
andcp39
but only one of them ends up in the pex file):