Skip to content

Run pants in docker from Apple M1 with --platform linux/amd64 fail with "Function not implemented" #19380

Open
@gabrielhora

Description

@gabrielhora

Describe the bug

I'm trying to run pants inside a docker container using linux/amd64 platform from a M1 Mac. The following exception is raised when running pants --version. As far as I understand this is coming from some QEMU emulation layer, but I'm not versed enough in it to know what is happening.

#8 [5/5] RUN pants --no-pantsd --version
#8 20.09 Bootstrapping Pants 2.15.0 using cpython 3.9.16
#8 20.09 Installing pantsbuild.pants==2.15.0 into a virtual environment at /root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0
#8 42.24      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 3.9 MB/s eta 0:00:00
#8 44.80      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 819.3/819.3 KB 18.9 MB/s eta 0:00:00
#8 45.23      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.5/64.5 KB 7.2 MB/s eta 0:00:00
#8 116.3 New virtual environment successfully created at /root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0.
#8 127.7 Exception caught: (builtins.ValueError)
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/bin/pants", line 8, in <module>
#8 127.7     sys.exit(main())
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 123, in main
#8 127.7     PantsLoader.main()
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 110, in main
#8 127.7     cls.run_default_entrypoint()
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 92, in run_default_entrypoint
#8 127.7     exit_code = runner.run(start_time)
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/bin/pants_runner.py", line 99, in run
#8 127.7     runner = LocalPantsRunner.create(
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 86, in create
#8 127.7     options_initializer = options_initializer or OptionsInitializer(
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/init/options_initializer.py", line 103, in __init__
#8 127.7     self._bootstrap_scheduler = create_bootstrap_scheduler(options_bootstrapper, executor)
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/init/options_initializer.py", line 75, in create_bootstrap_scheduler
#8 127.7     EngineInitializer.setup_graph(
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/init/engine_initializer.py", line 198, in setup_graph
#8 127.7     return EngineInitializer.setup_graph_extended(
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/init/engine_initializer.py", line 338, in setup_graph_extended
#8 127.7     scheduler = Scheduler(
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 216, in __init__
#8 127.7     self._py_scheduler = native_engine.scheduler_create(
#8 127.7 
#8 127.7 Exception message: Failed to begin watching the filesystem: Function not implemented (os error 38)
#8 127.7 NoneType: None
#8 ERROR: process "/bin/sh -c pants --no-pantsd --version" did not complete successfully: exit code: 1
------
 > [5/5] RUN pants --no-pantsd --version:
#8 127.7     EngineInitializer.setup_graph(
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/init/engine_initializer.py", line 198, in setup_graph
#8 127.7     return EngineInitializer.setup_graph_extended(
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/init/engine_initializer.py", line 338, in setup_graph_extended
#8 127.7     scheduler = Scheduler(
#8 127.7   File "/root/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 216, in __init__
#8 127.7     self._py_scheduler = native_engine.scheduler_create(
#8 127.7 
#8 127.7 Exception message: Failed to begin watching the filesystem: Function not implemented (os error 38)
#8 127.7 NoneType: None
------
Dockerfile:10
--------------------
   8 |     
   9 |     RUN echo "[GLOBAL]\npants_version = \"2.15.0\"" >> pants.toml
  10 | >>> RUN pants --no-pantsd --version
  11 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c pants --no-pantsd --version" did not complete successfully: exit code: 1

Pants version

2.15 (same with 2.16)

OS

Apple M1 Pro MacOS with Ventura 13.4.1

Additional info

The following simple dockerfile is enough to reproduce this problem (at least in a M1 device).

FROM --platform=linux/amd64 debian:stable-slim

ENV PATH="/root/bin:$PATH"

RUN apt-get update && apt-get install -y curl

RUN curl --proto '=https' --tlsv1.2 -fsSL https://static.pantsbuild.org/setup/get-pants.sh | bash

RUN echo "[GLOBAL]\npants_version = \"2.16.0\"" >> pants.toml
RUN pants --no-pantsd --version

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions