# general


01/23/2023, 10:15 AM
Hi! Within our project, we used to just copy pex files into Docker images. Now I tried to implement the "Simple Multi-Stage Build" approach from The thing is that it works for some of my images and not for others 🙂 I got quite confusing messages from Pants - first, I thought that there was some problem with dependency inference (see screen), but it turned out that it might be related to a problem with 3rd party dependency (fonttools?) - I tried to run
RUN PEX_TOOLS=1 /usr/local/bin/python3.10 /binary.pex venv --scope=deps --compile /bin/app
outside of Pants/Docker and got this (selected the interesting part):
Copy code
$ PEX_VERBOSE=9 PEX_TOOLS=1 python dist/src.python.arcor2_calibration.scripts/calibration.pex venv --scope=deps --compile appTest
pex: Laying out Spread PEX directory /home/zdenal/arcor2_repos/arcor2/dist/src.python.arcor2_calibration.scripts/calibration.pex: 0.1ms
pex: Executing installed PEX for /home/zdenal/arcor2_repos/arcor2/dist/src.python.arcor2_calibration.scripts/calibration.pex at /home/zdenal/.pex/unzipped_pexes/b1de9cb1dc137d74acdc0779598b9da266d9abcc
pex: Re-writing /home/zdenal/arcor2_repos/arcor2/appTest/bin/ttx
pex: Executing: /usr/bin/python3.10 -s -E -m compileall appTest
Traceback (most recent call last):
  File "/home/zdenal/.pex/unzipped_pexes/b1de9cb1dc137d74acdc0779598b9da266d9abcc/.bootstrap/pex/", line 105, in catch
    return func(*args, **kwargs)
  File "/home/zdenal/.pex/unzipped_pexes/b1de9cb1dc137d74acdc0779598b9da266d9abcc/.bootstrap/pex/tools/commands/", line 209, in run
    pex.interpreter.execute(["-m", "compileall", venv_dir])
  File "/home/zdenal/.pex/unzipped_pexes/b1de9cb1dc137d74acdc0779598b9da266d9abcc/.bootstrap/pex/", line 1239, in execute
    stdout, stderr = Executor.execute(cmd, stdin_payload=stdin_payload, env=env, **kwargs)
  File "/home/zdenal/.pex/unzipped_pexes/b1de9cb1dc137d74acdc0779598b9da266d9abcc/.bootstrap/pex/", line 99, in execute
    raise cls.NonZeroExit(cmd, process.returncode, stdout, stderr)
pex.executor.Executor.NonZeroExit: received exit code 1 during execution of `['/usr/bin/python3.10', '-s', '-E', '-m', 'compileall', 'appTest']` while trying to execute `['/usr/bin/python3.10', '-s', '-E', '-m', 'compileall', 'appTest']`
received exit code 1 during execution of `['/usr/bin/python3.10', '-s', '-E', '-m', 'compileall', 'appTest']` while trying to execute `['/usr/bin/python3.10', '-s', '-E', '-m', 'compileall', 'appTest']`
Any idea what might be wrong? Many thanks in advance!


01/23/2023, 10:45 AM
What pants version are you on? This is coming from PEX. I had similar issue. We had pushed the fix to some PEX version. Not sure if it has landed in the appropriate pants version.
Or you can add the fixed pex version in the pants.toml, if you don’t want to change the pants version itself
Copy code
version = "v2.1.120"
known_versions = [
I copied the sha256 from this commit The fix actually landed in pex 2.1.119


01/23/2023, 11:48 AM
Thank you! I'm on Pants 2.14.1, and I prefer to stay on the stable version so I change the version of pex-cli and it works now. Great.
🎉 1