pants: Pex binary errors when depending on a distribution
Describe the bug
I have a python_distribution target that can be successfully built. I have a pex_binary target that can also be built. However, when that pex_binary includes the distribution as a dependency, packaging the pex fails.
Here’s an example of what I have with some sensitive information redacted.
resources(name="all_my_things", sources=["<glob pattern for my py modules>"])
python_distribution(
name="things_distributed",
provides=python_artifact(name="things", version="0"),
dependencies=[":all_my_things"],
entry_points={
"console_scripts": {
"some_helpful_script": "path.to.my.script:main"
}
})
pex_binary(
name="executable_things",
script="conscript",
dependencies=[":things_distributed", "//:reqs#conscript"])
Running ./pants package :executable_things results in the following error and traceback
15:49:49.47 [ERROR] 1 Exception encountered:
Engine traceback:
in select
in pants.core.goals.run.run
in pants.backend.python.goals.run_pex_binary.create_pex_binary_run_request (//:executable_things)
in pants.backend.python.util_rules.local_dists.build_local_dists
in pants.backend.python.util_rules.local_dists.isolate_local_dist_wheels (//:things_distributed)
in pants.engine.process.fallible_to_exec_result_or_raise
Traceback (most recent call last):
File "/home/nathanael/.cache/pants/setup/bootstrap-Linux-x86_64/2.10.0_py38/lib/python3.8/site-packages/pants/engine/process.py", line 285, in fallible_to_exec_result_or_raise
raise ProcessExecutionFailure(
pants.engine.process.ProcessExecutionFailure: Process 'List contents of artifacts produced by //:things_distributed' failed with exit code 9.
stderr:
+ for f in things_distributed-0-py3-none-any.whl things_distributed-0.tar.gz
+ /usr/bin/unzip -Z1 things_distributed-0-py3-none-any.whl
+ for f in things_distributed-0-py3-none-any.whl things_distributed-0.tar.gz
+ /usr/bin/unzip -Z1 things_distributed-0.tar.gz
[things_distributed-0.tar.gz]
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
zipinfo: cannot find zipfile directory in one of things_distributed-0.tar.gz or
things_distributed-0.tar.gz.zip, and cannot find things_distributed-0.tar.gz.ZIP, period.
Pants version 2.10
OS Ubuntu 20.04
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 24 (17 by maintainers)
Commits related to this issue
- Upgrade Pex to 2.1.73. (#14875) This picks up several lockfile fixes. See the changelog here: https://github.com/pantsbuild/pex/releases/tag/v2.1.73 Fixes #14857 Fixes #14859 (cherry picked from... — committed to jsirois/pants by jsirois 2 years ago
- Upgrade Pex to 2.1.73. (Cherry-pick of #14875) (#15029) This picks up several lockfile fixes. See the changelog here: https://github.com/pantsbuild/pex/releases/tag/v2.1.73 Fixes #14857 Fix... — committed to pantsbuild/pants by jsirois 2 years ago
Update, looks like the .tar.gz problem is related to https://github.com/pantsbuild/pants/pull/14889 and if so should be fixed in 2.11.0. I’ll keep this open until we have confirmation that this is fixed in 2.11.x.
So now we’re left with the
my_module.pyproblem. @engnatha can you open a separate issue for that one? Thanks!Yeah, sorry, it’s an edited form of the real case. I’ve updated it to be more consistent hopefully.
I did try out
sdist=Falseand I am still able to./pants package :things_distributedfine, but I am getting a different hash error for running./pants package :executable_things