Has anyone seen an error like this before? I am tr...
# general
l
Has anyone seen an error like this before? I am trying to generate a lock file for a very simple dependency (just
python-constraint==1.4.0
) and it fails.
Copy code
23:00:27.47 [ERROR] 1 Exception encountered:

Engine traceback:
  in select
    ..
  in pants.core.goals.generate_lockfiles.generate_lockfiles_goal
    `generate-lockfiles` goal

Traceback (most recent call last):
  File "/user/.cache/nce/29319df9a6ca02e838617675b5b8dd7e5b18a393c27e74979823158b85c015d9/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 623, in native_engine_generator_send
    res = rule.send(arg) if err is None else rule.throw(throw or err)
  File "/user/.cache/nce/29319df9a6ca02e838617675b5b8dd7e5b18a393c27e74979823158b85c015d9/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/core/goals/generate_lockfiles.py", line 558, in generate_lockfiles_goal
    results = await MultiGet(
  File "/user/.cache/nce/29319df9a6ca02e838617675b5b8dd7e5b18a393c27e74979823158b85c015d9/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 358, in MultiGet
    return await _MultiGet(tuple(__arg0))
  File "/user/.cache/nce/29319df9a6ca02e838617675b5b8dd7e5b18a393c27e74979823158b85c015d9/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 165, in __await__
    result = yield self.gets
  File "/user/.cache/nce/29319df9a6ca02e838617675b5b8dd7e5b18a393c27e74979823158b85c015d9/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 623, in native_engine_generator_send
    res = rule.send(arg) if err is None else rule.throw(throw or err)
  File "/user/.cache/nce/29319df9a6ca02e838617675b5b8dd7e5b18a393c27e74979823158b85c015d9/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/backend/python/goals/lockfile.py", line 143, in generate_lockfile
    result = await Get(
  File "/user/.cache/nce/29319df9a6ca02e838617675b5b8dd7e5b18a393c27e74979823158b85c015d9/bindings/venvs/2.16.0/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 118, in __await__
    result = yield self
pants.engine.process.ProcessExecutionFailure: Process 'Generate lockfile for python-default' failed with exit code 1.
stdout:

stderr:
Unexpected archive type for sdist /tmp/pants-sandbox-Cv5l3D/.tmp/tmpixn1tha1/user..python_global.bin.python3/python-constraint-1.4.0.tar.bz2
It works in
2.15.2
but stops working in
2.16+
(I tried
2.16.1
,
2.17.1
,
2.19.1rc0
). I can install it with pip just fine.
Copy code
pip install python-constraint==1.4.0
Collecting python-constraint==1.4.0
  Using cached python-constraint-1.4.0.tar.bz2 (18 kB)
  Preparing metadata (setup.py) ... done
Installing collected packages: python-constraint
  DEPRECATION: python-constraint is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at <https://github.com/pypa/pip/issues/8559>
  Running setup.py install for python-constraint ... done
Successfully installed python-constraint-1.4.0
Very minimalistic Pants config:
Copy code
[GLOBAL]
pants_version = "2.16.0"

backend_packages = [
  "pants.backend.python",
]

[python]
interpreter_constraints = ["==3.9.*"]
enable_resolves = true
resolves_generate_lockfiles = true

[python.resolves]
python-default = "python-default.lock"

[source]
root_patterns = [
  "/"
]

[anonymous-telemetry]
enabled = false
āœ… 1
b
Sorry for the trouble and thanks for the detail. I don't have time to dig into this in detail right now, but here's something to get you started. From the description, my suspicion is that this is related to the version of PEX https://github.com/pex-tool/pex that the different pants versions use: • 2.15.2 uses 2.1.111: https://www.pantsbuild.org/2.15/reference/subsystems/pex-cli#version • 2.16.0 uses 2.1.134: https://www.pantsbuild.org/2.16/reference/subsystems/pex-cli#version So, a starting point for debugging might be seeing if this reproduces with pex outside of pants. For instance, something like:
Copy code
pip install pex==2.1.134
pex3 lock create python-constraint==1.4.0
(I'm just guessing at the command Pants is running, you can confirm with https://www.pantsbuild.org/2.19/docs/using-pants/troubleshooting-common-issues#debug-tip-inspect-the-sandbox-with---keep-sandboxes ) If you can reproduce it outside of Pants, then I'd suggest filing a bug against PEX. If you can bisect which pex version introduced the regression that'd be even better šŸ™‚
also, if it is a pex bug, it may've already been fixed, so do try with the latest version of pex too. If it is fixed, you can manually upgrade by customising the
known_versions
and
version
properties so that they point to the latest release (in the
[pex-cli]
subsystem docs linked above)
l
Awesome, thanks @broad-processor-92400! I will give it a go and report back šŸ™‚
Alright, it is Pex
2.1.122
which changed it. More details at https://github.com/pex-tool/pex/issues/2379. The TL;DR: Pex only supports
.zip
and
.tar.gz
.
šŸ‘ 1
b
It looks like that fix is released: https://github.com/pex-tool/pex/releases/tag/v2.2.2 You can hopefully upgrade all the way to that following the hints above
šŸ‘ 1
l
Yes, thanks @broad-processor-92400. For others, this is the Pants config that I had to use:
Copy code
[pex-cli]
version = "v2.2.2"
known_versions = [
  "v2.2.2|macos_arm64|a27f9881610c5682b71104e17fea21a7bdb79b57c0c8129a6119390f216e0a02|4113902",
  "v2.2.2|macos_x86_64|a27f9881610c5682b71104e17fea21a7bdb79b57c0c8129a6119390f216e0a02|4113902",
  "v2.2.2|linux_x86_64|a27f9881610c5682b71104e17fea21a7bdb79b57c0c8129a6119390f216e0a02|4113902",
  "v2.2.2|linux_arm64|a27f9881610c5682b71104e17fea21a7bdb79b57c0c8129a6119390f216e0a02|4113902",
]
šŸ‘ 1