I had an issue with pants package in a VSCode dev ...
# general
f
I had an issue with pants package in a VSCode dev container on an Apple Mac Mini (m1) where it seemed like Go was not installed. At least, when I added Go to the dev container the problem went away. Is this a base container issue, or a pants issue?
b
Sorry for the trouble. We’ll need some more details to help. Were you trying to do something with the pants repository itself, or with your own code using pants?
f
My own code. The repo is here https://github.com/naccdata/form-upload-demo though I added Go to the devcontainer here https://github.com/naccdata/form-upload-demo/blob/5ed0df0ebbae9b05e8c7d343d69130d85310472e/.devcontainer/devcontainer.json#L15 and the problem went away. The error came up when building docker_parser.pex. The specific error was that there was no
go
I could probably build you a smaller example, but it might be a couple of weeks until I have time
b
Ah okay, that's useful info! Pulling some pieces together: • It looks like the
dockerfile
library used in that
docker_parser.pex
only publishes a few pre-built binary wheels: https://pypi.org/project/dockerfile/#files • From https://github.com/asottile/dockerfile it looks like a from-source build indeed requires Go. • This suggests to me that the dev container system can't use the binary wheels and so has to do the source build Can you run these commands in the dev container and report what it says? •
python -c 'import platform; print(platform.platform())'
pip install --no-cache dockerfile --target /tmp/
f
without Go installed?
👍 1
b
For this, it doesn't matter (the pip install might fail without go installed, but the output before that is what's interesting: whether it downloasd a wheel or decides to do a source build), whatever's easiest for you.
f
platform: Linux-6.6.22-linuxkit-aarch64-with-glibc2.31
with Go:
Copy code
Collecting dockerfile
  Downloading dockerfile-3.3.1.tar.gz (6.9 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: dockerfile
  Building wheel for dockerfile (setup.py) ... done
  Created wheel for dockerfile: filename=dockerfile-3.3.1-cp311-abi3-linux_aarch64.whl size=1879429 sha256=023090800059de7e44853c4ac68315fbc2dc6701f491b162494f0c5e5a0c90af
  Stored in directory: /tmp/pip-ephem-wheel-cache-4rbfmvz8/wheels/e7/b7/90/df4e847fa0948a16694b14c544246ea110f4029bd2995c7e7b
Successfully built dockerfile
Installing collected packages: dockerfile
Successfully installed dockerfile-3.3.1
without:
Copy code
Collecting dockerfile
  Downloading dockerfile-3.3.1.tar.gz (6.9 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: dockerfile
  Building wheel for dockerfile (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      /usr/local/lib/python3.11/site-packages/setuptools/__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!
      
              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************
      
      !!
        dist.fetch_build_eggs(dist.setup_requires)
      running bdist_wheel
      running build
      running build_ext
      $ GOPATH=/tmp/tmp1u_f7pm_ go get -d
      error: [Errno 2] No such file or directory: 'go'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for dockerfile
  Running setup.py clean for dockerfile
Failed to build dockerfile
ERROR: Could not build wheels for dockerfile, which is required to install pyproject.toml-based projects
b
Ah, okay, cool. That looks like it's running ARM Linux, which
dockerfile
indeed doesn't publish a binary wheel for. So, I think possible paths forward are: Immediate term: 1. just install Go so that the package can be built from source, as you've done 2. build the requisite wheel yourself separately (and e.g. put it in a private registry or on disk somewhere), create a resolve that installs that, and use
[dockerfile-parser].install_from_resolve
to have Pants use that one Longer term: 1. work with
dockerfile
upstream to also publish Linux ARM wheels 2. find a different dockerfile parser library for the
pants.backend.docker
backend to use (and contribute that change 🙂 )
f
Good to know. Thanks for the guidance!
b