I don't reproduce with a hand-created venv
# pex
h
I don't reproduce with a hand-created venv
e
There should be nothing special about the venvs. They are hand-created too - of sorts - using `python -mvenv`: https://github.com/pantsbuild/pex/blob/4619b107b1e6c37cfd98a1b0f43bb4f7a33d3945/pex/tools/commands/virtualenv.py#L92-L97
I studiously avoid pyenv shims. I'll set some up and see if I can repro though.
But hopefully you've already poked at your post-activate
env
in the hand case and the pex case to see if there are differences there.
Have you tried explicitly creating a venv from the PEX?
PEX_TOOLS=1 the.pex venv --help
I'd guess that venv gives you the same troubles, but maybe worth a spin.
Ah - nothing to do with shims. the activate script seems to be straight up broken when its auto-created under ~/.pex/venvs due to atomic directory shenanigans. If you manually create with PEX_TOOLS=1 that works just fine.
I'll file an issue here in a bit - there should be a way around the atomic directory temp dir issue.
The basic problem is summarized by this:
Copy code
$ grep VIRTUAL_ENV= /home/jsirois/.pex/venvs/58fcefe170c11af69bfde52b33ba6424ccb3260f/800ae8ef047bd783543e8282c22bfdbee7b7fca8/bin/activate 
VIRTUAL_ENV="/home/jsirois/.pex/venvs/58fcefe170c11af69bfde52b33ba6424ccb3260f/800ae8ef047bd783543e8282c22bfdbee7b7fca8.9c28554a8e4c4931a664c3d329088975"
The two paths don't match since the venv - when auto-created under ~/pex/venvs - is created in a temporary directory that is atomically renamed. That leads to a mismatch in the script contents and the final resting venv dir name.
h
aha
I worked around it, but good to know this was a real issue and not a brain injury
Thanks