https://pantsbuild.org/ logo
#general
Title
# general
h

high-yak-85899

10/18/2022, 10:04 PM
Has anyone tried to run a pex from a distroless container?
Their python image is still marked as experimental for the foreseeable future, but I despise how big python docker containers are.
e

enough-analyst-54434

10/18/2022, 10:56 PM
Copy code
$ pex cowsay -c cowsay -o cowsay.pex --venv
$ docker run --rm -it -v $PWD/cowsay.pex:/cowsay.pex <http://gcr.io/distroless/python3-debian11|gcr.io/distroless/python3-debian11> /cowsay.pex 'Moo!'
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
  ____
| Moo! |
  ====
    \
     \
       ^__^
       (oo)\_______
       (__)\       )\/\
           ||----w |
           ||     ||
h

high-yak-85899

10/18/2022, 11:01 PM
Yup, I just got nearly that far too! Running into this though
Copy code
Examined the following interpreters:
1.) /usr/bin/python3.9 CPython==3.9.2

No interpreter compatible with the requested constraints was found:

  A distribution for hidapi could not be resolved for /usr/bin/python3.9.
  Found 1 distribution for hidapi that do not apply:
  1.) The wheel tags for hidapi 0.12.0.post2 are cp38-cp38-manylinux2014_x86_64, cp38-cp38-manylinux_2_17_x86_64 which do not match the supported tags of /usr/bin/python3.9:
  cp39-cp39-manylinux_2_31_x86_64
  ... 661 more ...
which is a little surprising because I have a constraint of python>=3.8,<3.10 in
pants.toml
and the pex lockfile says there's a distribution for the version of that package
e

enough-analyst-54434

10/18/2022, 11:02 PM
If you don't have 3.9 on the host, the PEX won't have 3.9 wheels in it. When that PEX gets run on a machine without 3.8, boom.
h

high-yak-85899

10/18/2022, 11:02 PM
Yup, was just about to type that up. Thanks for confirming
e

enough-analyst-54434

10/18/2022, 11:03 PM
The ICs aren't magic. You must have interpreters to fit the range if you want to satisfy the range on other machines,
You can get 3.9 wheels in using --platform or --complete-platform if that's needed.
6 Views