Has anyone tried to run a pex from a <distroless c...
# general
h
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
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
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
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
Yup, was just about to type that up. Thanks for confirming
e
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.