Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building local_dists.pex fails with Rosetta emulation in docker environment on Mac M1 #19587

Open
JoostvDoorn opened this issue Aug 11, 2023 · 7 comments
Labels

Comments

@JoostvDoorn
Copy link

Describe the bug
When using the environments feature on Mac M1 fails the Building local_dists.pex step with the following error occurs:

09:13:10.28 [INFO] Completed: Building local_dists.pex
09:13:10.29 [ERROR] 1 Exception encountered:

Engine traceback:
  in `package` goal

ProcessExecutionFailure: Process 'Building local_dists.pex' failed with exit code 139.
stdout:

stderr:



Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.

I figured out that this was caused by the use of Rosetta for x86/amd64 emulation on Apple Silicon feature being turned on. This feature was turned on as it allows me to run certain other projects properly.

To reproduce:
Docker desktop settings ->
Features in development ->
Beta features ->
Use Rosetta for x86/amd64 emulation on Apple Silicon (turn on to fail)

Pants version
Which version of Pants are you using?
2.16.0

OS
Are you encountering the bug on MacOS, Linux, or both?
MacOS 13.5 (22G74)

Additional info
Add any other information about the problem here, such as attachments or links to gists, if relevant.

@WorkerPants
Copy link
Member

Welcome to the Pantsbuild Community. This looks like your first issue here. Thanks for taking the time to write it.

If you haven't already, feel free to come say hi on Slack.

If you have questions, or just want to surface this issue, check out the #development channel.
(If you want to check it out without logging in, check out our Linen mirror)

Thanks again, and we look forward to your next Issue/PR 😄!

@dcandrade
Copy link

Same issue here. How can we help to improve this?

@gauthamnair
Copy link
Contributor

@dcandrade @JoostvDoorn could you supply more details about the setup so that we could reproduce? Does it require using the environments feature? Or are you generally getting a failure any time local_dists are involved and you have emulation on?

@JoostvDoorn
Copy link
Author

@dcandrade @JoostvDoorn could you supply more details about the setup so that we could reproduce? Does it require using the environments feature? Or are you generally getting a failure any time local_dists are involved and you have emulation on?

It does indeed require using the environments. Configuration is something like:
some/path/Dockerfile

FROM --platform=amd64 python:3.10-slim

WORKDIR /bin/app

COPY some_path/pex.pex pex

ENTRYPOINT ["/bin/app/pex", "-m"]
CMD ["command"]

some/path/BUILD

docker_image(
    name="docker",
    registries=["@something"],
    repository="something",
    image_tags=["latest"],
)

pex_binary(
    name="pex",
    dependencies=[
        ...
    ],
    environment="linux_amd64",
    platforms=["linux-x86_64-cp-310-cp310"],
)

pants.toml

[environments-preview.names]
linux_amd64 = "//:linux_amd64"
docker_linux_amd64 = "//:docker_linux_amd64"

/BUILD

local_environment(
    name="linux_amd64",
    compatible_platforms=["linux_x86_64"],
    fallback_environment="docker_linux_amd64",
)

docker_environment(
    name="docker_linux_amd64",
    platform="linux_x86_64",
    image="python:3.10",
    python_bootstrap_search_path=["<PATH>"],
)

@dcandrade
Copy link

dcandrade commented Oct 7, 2023

The setup here is very similar to the one mentioned by @JoostvDoorn, but using MacOS alongside Colima/rancher as container runtime

With rancher I get the mentioned error, but with Colima I get a too many open files error

@philipva-disco
Copy link

MacOS Sonoma seems to have fixed this for me.

@dcandrade
Copy link

Same here. Isn't happening anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants