As reported over in https://github.com/pantsbuild/pants/issues/12984, the pants script uses the Pex PEX to create a virtual environment for pantsbuild.pants and this is thwarted if an alternate PEX entrypoint is specified via environment variables:
$ PEX_MODULE=foo ./pants -V
Bootstrapping Pants using /usr/local/bin/python3.8
Creating the virtualenv PEX.
Downloading the Pex PEX.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 609 100 609 0 0 3736 0 --:--:-- --:--:-- --:--:-- 3736
100 3529k 100 3529k 0 0 3211k 0 0:00:01 0:00:01 --:--:-- 4346k
SHA256 fingerprint of https://github.com/pantsbuild/pex/releases/download/v2.1.42/pex verified.
Traceback (most recent call last):
File "/root/.pex/unzipped_pexes/478cc1fa371ca40aa3e7dafee735ca438d4a243f/.bootstrap/pex/pex.py", line 484, in execute
exit_value = self._wrap_coverage(self._wrap_profiling, self._execute)
File "/root/.pex/unzipped_pexes/478cc1fa371ca40aa3e7dafee735ca438d4a243f/.bootstrap/pex/pex.py", line 401, in _wrap_coverage
return runner(*args)
File "/root/.pex/unzipped_pexes/478cc1fa371ca40aa3e7dafee735ca438d4a243f/.bootstrap/pex/pex.py", line 432, in _wrap_profiling
return runner(*args)
File "/root/.pex/unzipped_pexes/478cc1fa371ca40aa3e7dafee735ca438d4a243f/.bootstrap/pex/pex.py", line 536, in _execute
return self.execute_entry(self._pex_info_overrides.entry_point)
File "/root/.pex/unzipped_pexes/478cc1fa371ca40aa3e7dafee735ca438d4a243f/.bootstrap/pex/pex.py", line 667, in execute_entry
return self.execute_module(entry_point, alter_sys)
File "/root/.pex/unzipped_pexes/478cc1fa371ca40aa3e7dafee735ca438d4a243f/.bootstrap/pex/pex.py", line 679, in execute_module
runpy.run_module(module_name, run_name="__main__", alter_sys=alter_sys)
File "/usr/local/lib/python3.8/runpy.py", line 203, in run_module
mod_name, mod_spec, code = _get_module_details(mod_name)
File "/usr/local/lib/python3.8/runpy.py", line 138, in _get_module_details
raise error("No module named %s" % mod_name)
ImportError: No module named foo
mv: cannot stat '/root/.cache/pants/setup/bootstrap-Linux-x86_64/pants.fvP0e0/virtualenv.pex': No such file or directory
Installing pantsbuild.pants==2.6.1 into a virtual environment at /root/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.1_py38
/usr/local/bin/python3.8: can't open file '/root/.cache/pants/setup/bootstrap-Linux-x86_64/virtualenv-20.4.7/virtualenv.pex': [Errno 2] No such file or directory
The command '/bin/sh -c ./pants --version' returned a non-zero code: 1
As reported over in https://github.com/pantsbuild/pants/issues/12984, the
pants
script uses the Pex PEX to create a virtual environment forpantsbuild.pants
and this is thwarted if an alternate PEX entrypoint is specified via environment variables: