https://pantsbuild.org/ logo
#pex
Title
# pex
w

witty-crayon-22786

03/16/2020, 3:26 PM
we have seen a recent occurrence of the "pexrc is used from pants" issue
having thought more about it, it feels like it is a fairly straightforward hermeticity violation. pants should disable pexrc when using pex, period (and add explicit settings for the kinds of things you'd put in pexrc)
๐Ÿ‘ 1
h

hundreds-father-404

03/16/2020, 3:32 PM
I agree. I donโ€™t think many users use Pexrc
e

enough-analyst-54434

03/16/2020, 3:56 PM
Already attempting to be done fwiw:
Copy code
$ git grep RCFILES
src/python/pants/backend/python/rules/hermetic_pex.py:            PEX_IGNORE_RCFILES="true",
src/python/pants/backend/python/tasks/python_execution_task_base.py:        "PEX_IGNORE_RCFILES": "1",
๐Ÿ‘ 1
w

witty-crayon-22786

03/16/2020, 4:27 PM
hm. the recent occurrence i saw was in a v2 rule somewhere... @red-balloon-89377 also repro'd
Copy code
./v2 --changed-since=master fmt
Failed to execute PEX file. Needed macosx_10_14_x86_64-cp-37-cp37m compatible dependencies for:
 1: docformatter==1.3.1
    But this pex only contains:
      docformatter-1.3.1-py2-none-any.whl
 2: untokenize==0.1.1
    But this pex only contains:
      untokenize-0.1.1-py2-none-any.whl
)
... the error implies that it is a runtime error, which looks like it should have been affected by the line in
hermetic_pex.py
afaict
e

enough-analyst-54434

03/16/2020, 4:27 PM
How did you get from that failure to pexrc?
w

witty-crayon-22786

03/16/2020, 4:28 PM
moving aside
/etc/pexrc
resolves the issue
e

enough-analyst-54434

03/16/2020, 4:28 PM
OK, and what does pexrc contain?
w

witty-crayon-22786

03/16/2020, 4:29 PM
Copy code
$ cat /etc/pexrc
PEX_PYTHON_PATH=/my/custom/python/2.7/bin/python2.7:/my/custom/python/3.6/bin/python3.6:/my/custom/python/3.7/bin/python3.7
PEX_PYTHON=/my/custom/python/2.7/bin/python2.7
e

enough-analyst-54434

03/16/2020, 4:29 PM
OK - ty. I'll dig a bit.
w

witty-crayon-22786

03/16/2020, 4:31 PM
thanks... i know that this is really on us. but we hadn't seen a repro of this issue for a while, and it only recently started recurring. got lazy.
e

enough-analyst-54434

03/16/2020, 4:39 PM
Oh - ok - above is easy. ~All problems in pex require separating runtime from buildtime clearly in your mind (personal reminder). We ignore rcfiles at runtime but not at buildtime. I'll encode this in an issue after I check over where we might miss this in v1 too.
๐Ÿ‘– 2
w

witty-crayon-22786

03/16/2020, 4:41 PM
Awesome.
Thanks a ton!
e

enough-analyst-54434

03/16/2020, 5:19 PM
You're welcome. It does look you tried to point this out in the past but the case is a but muddled / details a bit lacking: https://github.com/pantsbuild/pants/issues/7816 I'll likely run with that issue and add details there.