joining the crowd having issues with environments ...
# general
w
joining the crowd having issues with environments on an arm64 mac: trying to build a pex in a container on my machine (macos arm64):
Copy code
local_environment(
  name="local",
  compatible_platforms=["linux_x86_64"],
  fallback_environment="container",
)

docker_environment(
    name="container",
    platform="linux_x86_64",
    image="python:3.11-buster",
)
get the following error about not being able to find the correct interpreter (or any):
Copy code
pants -ldebug package src/grid_services_function:telemetry_subscriber
...
19:00:11.36 [DEBUG] Completed: setup_sandbox
19:00:11.40 [DEBUG] Completed: Searching for `tar` on PATH=/usr/bin:/bin:/usr/local/bin:/opt/homebrew/bin
19:00:11.40 [DEBUG] Completed: Scheduling: Searching for `tar` on PATH=/usr/bin:/bin:/usr/local/bin:/opt/homebrew/bin
19:00:11.40 [DEBUG] Completed: acquire_command_runner_slot
19:00:11.40 [DEBUG] Running Test binary /bin/tar. under semaphore with concurrency id: 1, and concurrency: 1
19:00:11.40 [DEBUG] Completed: setup_sandbox
19:00:11.43 [DEBUG] Completed: Test binary /bin/tar.
19:00:11.43 [DEBUG] Completed: Scheduling: Test binary /bin/tar.
19:00:11.43 [DEBUG] Completed: Finding the `tar` binary - environment:container
19:00:11.43 [DEBUG] Completed: acquire_command_runner_slot
19:00:11.43 [DEBUG] Running Extract Pants' execution Python under semaphore with concurrency id: 1, and concurrency: 1
19:00:11.43 [DEBUG] Completed: setup_sandbox
19:00:13.64 [DEBUG] Completed: Extract Pants' execution Python
19:00:13.64 [DEBUG] Completed: Scheduling: Extract Pants' execution Python
19:00:13.64 [DEBUG] Completed: acquire_command_runner_slot
19:00:13.64 [DEBUG] Running Install Python for Pants usage under semaphore with concurrency id: 1, and concurrency: 1
19:00:13.87 [DEBUG] Completed: setup_sandbox
19:00:14.34 [DEBUG] Completed: Install Python for Pants usage
19:00:14.34 [DEBUG] Completed: Scheduling: Install Python for Pants usage
19:00:14.34 [DEBUG] Completed: Prepare environment for running PEXes - environment:container
19:00:14.35 [DEBUG] Completed: acquire_command_runner_slot
19:00:14.35 [DEBUG] Running Find interpreter for constraints: CPython==3.11.* under semaphore with concurrency id: 1, and concurrency: 1
19:00:14.39 [DEBUG] Completed: setup_sandbox
19:00:15.95 [DEBUG] Completed: Find interpreter for constraints: CPython==3.11.*
19:00:15.95 [DEBUG] Completed: Scheduling: Find interpreter for constraints: CPython==3.11.*
19:00:15.95 [DEBUG] Completed: Find Python interpreter for constraints - (CPython==3.11.*, environment:container)
19:00:15.95 [DEBUG] Completed: pants.backend.python.util_rules.pex.build_pex
19:00:15.95 [DEBUG] Completed: pants.backend.python.util_rules.pex_from_targets.create_pex_from_targets
19:00:15.96 [DEBUG] Completed: `package` goal
19:00:15.96 [DEBUG] computed 1 nodes in 40.009645 seconds. there are 8914 total nodes.
19:00:15.96 [ERROR] 1 Exception encountered:

Engine traceback:
  in `package` goal

ProcessExecutionFailure: Process 'Find interpreter for constraints: CPython==3.11.*' failed with exit code 102.
stdout:

stderr:
Could not find a compatible interpreter.

No interpreters could be found on the system.
thankfully because of https://github.com/pantsbuild/pants/issues/18307 (/s) the build container is left running and i can check out its path etc:
Copy code
docker exec -it 5e05e9cb6b1a bash

root@5e05e9cb6b1a:/# python3.11
Python 3.11.4 (main, Jun 13 2023, 15:25:25) [GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
root@5e05e9cb6b1a:/# which python3.11
/usr/local/bin/python3.11
so not sure what's going on here, any pointers?
related: i get errors using the exact same image name as what we use for local dev, i've worked around it by removing the slim from our build container image:
Copy code
IntrinsicError: Failed to create Docker container: DockerResponseServerError { status_code: 404, message: "image with reference sha256:12cacc23b6dec78ca7b056d56e3de48252669ed49fffd95ed36adbf9dfe3cec0 was found but does not match the specified platform: wanted linux/amd64, actual: linux/arm64/v8" }
same issue with slim-buster, ubuntu:latest and with
python_bootstrap_search_path=["<PATH>"]
w
Are there any other items being packaged? Like a
pex
on your host machine, that would need 3.11?
w
the reason we are pinning to 3.11 is because of some deep dependency clash (as usual), i can build the same pex for my host arch without issue, the reason i am trying to build for x64 is to ensure my pex is correctly configured before it goes to CI, and i would also like to build for aarch64 because we run integration tests with
pytest-docker
and the native pex then does not work when run in a container. fwiw i relaxed the 3.11 constraint to see if it would get to pip installs at least and the error was the same, clearly some kind of path issue:
Copy code
ProcessExecutionFailure: Process 'Find interpreter for constraints: CPython==3.11.* OR CPython==3.12.*' failed with exit code 102.
stdout:

stderr:
Could not find a compatible interpreter.

No interpreters could be found on the system.
this is all being run in a nix env btw. what further info can i supply? or flags/cmds to debug what paths are being searched for the interpreter?