swift-river-73520
03/27/2023, 10:45 PMdocker_image
target and a simple Dockerfile on a MAC M1, it looks like the dockerfile
module used by pants in my setup was compiled for x86_64
but I need the arm64
one. this feels like it might have something to do with this blurb on Mac interpreters. but changing the interpreter_search_paths
property doesn't seem to have any affect, I suspect because that is probably referring to setting the python interpreter for the python backend tools and doesn't affect the docker backend tools. how do I get pants to create and use the arm64
dockerfile module?
here's the actual error:
Traceback (most recent call last):
File "/private/var/folders/0k/c0crrpz142n_h62r7nnmpnsr0000gn/T/pants-sandbox-IbPeOY/.cache/pex_root/venvs/3d84392e96bb69d7972ace4055cb0144a30b9e8e/a58c33d44cdb8a7bd8160aa976f1a158437bee6a/pex", line 243, in <module>
runpy.run_module(module_name, run_name="__main__", alter_sys=True)
File "/Users/zach/.pyenv/versions/3.7.16/lib/python3.7/runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/Users/zach/.pyenv/versions/3.7.16/lib/python3.7/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/Users/zach/.pyenv/versions/3.7.16/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/zach/.cache/pants/named_caches/pex_root/venvs/s/b9c7c433/venv/lib/python3.7/site-packages/__pants_df_parser.py", line 202, in <module>
print(json.dumps([asdict(info) for info in main(*sys.argv[1:])]))
File "/Users/zach/.cache/pants/named_caches/pex_root/venvs/s/b9c7c433/venv/lib/python3.7/site-packages/__pants_df_parser.py", line 202, in <listcomp>
print(json.dumps([asdict(info) for info in main(*sys.argv[1:])]))
File "/Users/zach/.cache/pants/named_caches/pex_root/venvs/s/b9c7c433/venv/lib/python3.7/site-packages/__pants_df_parser.py", line 61, in main
from dockerfile import Command, parse_file, parse_string # pants: no-infer-dep
ImportError: dlopen(/Users/zach/.cache/pants/named_caches/pex_root/venvs/s/b9c7c433/venv/lib/python3.7/site-packages/dockerfile.abi3.so, 0x0002): tried: '/Users/zach/.cache/pants/named_caches/pex_root/venvs/s/b9c7c433/venv/lib/python3.7/site-packages/dockerfile.abi3.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/zach/.cache/pants/named_caches/pex_root/venvs/s/b9c7c433/venv/lib/python3.7/site-packages/dockerfile.abi3.so' (no such file), '/Users/zach/.cache/pants/named_caches/pex_root/venvs/s/b9c7c433/venv/lib/python3.7/site-packages/dockerfile.abi3.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/Users/zach/.cache/pants/named_caches/pex_root/venvs/3d84392e96bb69d7972ace4055cb0144a30b9e8e/a58c33d44cdb8a7bd8160aa976f1a158437bee6a/lib/python3.7/site-packages/dockerfile.abi3.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/zach/.cache/pants/named_caches/pex_root/venvs/3d84392e96bb69d7972ace4055cb0144a30b9e8e/a58c33d44cdb8a7bd8160aa976f1a158437bee6a/lib/python3.7/site-packages/dockerfile.abi3.so' (no such file), '/Users/zach/.cache/pants/named_caches/pex_root/venvs/3d84392e96bb69d7972ace4055cb0144a30b9e8e/a58c33d44cdb8a7bd8160aa976f1a158437bee6a/lib/python3.7/site-packages/dockerfile.abi3.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
swift-river-73520
03/28/2023, 12:25 AMdocker_image
targetswift-river-73520
03/28/2023, 12:27 AMdocker_image
, or maybe the platform it's building on, but I don't see any options to do so. I found the docker_environment
target, but that seems to be more for building pex bins in a docker imagerefined-addition-53644
03/28/2023, 8:54 AMplatform
arg inside your dockerfile.
https://docs.docker.com/build/building/multi-platform/
You can pass it as a build arg using extra_build_args
as mentioned here
https://www.pantsbuild.org/docs/reference-docker_image#codeextra_build_argscodeswift-river-73520
03/28/2023, 4:06 PMdockerfile
module getting installed into that environment by pants doesn't work on arm64.swift-river-73520
03/28/2023, 4:20 PMrefined-addition-53644
03/28/2023, 4:21 PMswift-river-73520
03/28/2023, 4:22 PMrefined-addition-53644
03/28/2023, 4:22 PMswift-river-73520
03/28/2023, 4:23 PMrefined-addition-53644
03/28/2023, 4:32 PMsearch_path
as mentioned here
https://www.pantsbuild.org/docs/python-backend
search_path = ["<PYENV>"]
swift-river-73520
03/28/2023, 4:49 PM[python-bootstrap]
search_path = [
"<PYENV>"
]
and also
[python-bootstrap]
search_path = [
"<PYENV>",
"/usr/local/bin"
]
and neither seem to help. i'm starting to go down this rabbithole - https://chat.pantsbuild.org/t/9728005/hey-i-m-having-some-python-architecture-issues-when-running-refined-addition-53644
03/28/2023, 4:49 PMswift-river-73520
03/28/2023, 4:51 PM/Users/zach/.cache/pants/...
yesterday (maybe that's not all the caches I need to delete) and it didn't fix anything, so I was going to try deleting those again and also re-bootstrapping pants (I haven't re-installed / re-bootstrapped pants yet)swift-river-73520
03/28/2023, 5:24 PMFailed to fire hook: while creating logrus local file hook: user: Current requires cgo or $USER, $HOME set in environment
[2023-03-28T17:12:42.321711000Z][docker-credential-desktop][F] get system info: exec: "sw_vers": executable file not found in $PATH
[goroutine 1 [running, locked to thread]:
[common/pkg/system.init.0()
[ common/pkg/system/os_info.go:32 +0x1bc
#1 [internal] load build definition from Dockerfile
#1 sha256:032127a65a56b6218cb6a39f6c46a2bd1886f25ac038428bb1898700cc83690f
#1 transferring dockerfile: 527B done
#1 DONE 0.0s
#2 [internal] load .dockerignore
#2 sha256:3bfa667b48f39e2780fa18acbe3815dd6ab7742db5f9255a09791dbb232fd7d2
#2 transferring context: 2B done
#2 DONE 0.0s
#3 [internal] load metadata for <http://docker.io/library/python:3.9-slim|docker.io/library/python:3.9-slim>
#3 sha256:f8eb7dab72bf96d7bbead0e5af425ba155d110a0ad106da163686a19dc0c221c
Failed to fire hook: while creating logrus local file hook: user: Current requires cgo or $USER, $HOME set in environment
[2023-03-28T17:12:42.836587000Z][docker-credential-desktop][F] get system info: exec: "sw_vers": executable file not found in $PATH
[goroutine 1 [running, locked to thread]:
[common/pkg/system.init.0()
[ common/pkg/system/os_info.go:32 +0x1bc
Failed to fire hook: while creating logrus local file hook: user: Current requires cgo or $USER, $HOME set in environment
[2023-03-28T17:12:42.852891000Z][docker-credential-desktop][F] get system info: exec: "sw_vers": executable file not found in $PATH
[goroutine 1 [running, locked to thread]:
[common/pkg/system.init.0()
[ common/pkg/system/os_info.go:32 +0x1bc
#3 ERROR: rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: ``
------
> [internal] load metadata for <http://docker.io/library/python:3.9-slim|docker.io/library/python:3.9-slim>:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: ``
so now it feels like cgo isn't installed, but I've done xcode-select --install
and brew install gcc
(these were done before I started working with pants).
I found this very similar thread that indicates some config / env settings need to get passed through, but doesn't indicate which ones or how they should be passed throughswift-river-73520
03/28/2023, 5:25 PMrefined-addition-53644
03/28/2023, 5:35 PMswift-river-73520
03/28/2023, 5:35 PMswift-river-73520
03/28/2023, 8:40 PM