fresh-cat-90827
06/28/2023, 1:36 PMFailed to find a compatible PEX_PYTHON=.python-build-standalone/python/bin/python3.
when attempting to package a pex_binary
inside a Docker environment. ๐งตfresh-cat-90827
06/28/2023, 1:36 PMdiff --git a/BUILD b/BUILD
index fca77e4..0acfb4b 100644
--- a/BUILD
+++ b/BUILD
@@ -5,3 +5,10 @@
# `python_requirement_library` target. Refer to
# <https://www.pantsbuild.org/docs/python-third-party-dependencies>.
python_requirements(name="reqs")
+
+docker_environment(
+ name="ubuntu-base",
+ platform="linux_x86_64",
+ image="ubuntu",
+ python_bootstrap_search_path=["<PATH>"],
+)
diff --git a/helloworld/BUILD b/helloworld/BUILD
index 5e55812..c882cf7 100644
--- a/helloworld/BUILD
+++ b/helloworld/BUILD
@@ -13,4 +13,5 @@ python_sources(
pex_binary(
name="pex_binary",
entry_point="main.py",
+ environment="linux_docker"
)
diff --git a/pants.toml b/pants.toml
index d0981a6..f15b626 100644
--- a/pants.toml
+++ b/pants.toml
@@ -44,3 +44,6 @@ resolves = { python-default = "python-default.lock"}
# problematic system Pythons. See
# <https://www.pantsbuild.org/docs/python-interpreter-compatibility#changing-the-interpreter-search-path>.
search_path = ["<PATH>", "<PYENV>"]
+
+[environments-preview.names]
+linux_docker = "//:ubuntu-base"
I have
$ pants package ::
14:31:27.08 [INFO] Completed: Building local_dists.pex
14:31:27.08 [ERROR] 1 Exception encountered:
Engine traceback:
in `package` goal
ProcessExecutionFailure: Process 'Building local_dists.pex' failed with exit code 1.
stdout:
stderr:
Failed to find a compatible PEX_PYTHON=.python-build-standalone/python/bin/python3.
No interpreters could be found on the system.
inside the sandbox I've asked to keep on failure, I see a symlink
.python-build-standalone -> /pants-immutable-inputs/.tmpctvJXn/c12164f0e9228ec20704c1aba97eb31b8e2a482d41943d541cc8e3a9e84f7349
Tried to set export PEX_PYTHON=/usr/bin/python3;
before running Pants and pointing to them in
docker_environment(
name="ubuntu-base",
platform="linux_x86_64",
image="ubuntu",
python_bootstrap_search_path=["<PATH>"],
docker_env_vars=["PEX_PYTHON"],
subprocess_environment_env_vars=["PEX_PYTHON"],
)
but same result.bitter-ability-32190
06/28/2023, 2:11 PMfresh-cat-90827
06/28/2023, 2:50 PM