Hi, is there any way to get the equivalent of `pex...
# general
p
Hi, is there any way to get the equivalent of `pex_binary`'s
execution_mode="venv"
and
venv_site_packages_copies=True
with
pants run path/to/some/file.py
? I have some source file that depends on
torch
and it looks like the 3rd-party libraries are explicitly looking for files in the virtual environment.
path/to/some/file.py
is available as a
python_source
.
b
I think there may not be, so building/running a pex may be the most reliable way to get that behaviour
p
OK. Thanks.
It would be nice if the pex settings were available as global options for
run
goal. We have a bunch of ad-hoc / utility scripts that people run locally for various experiments and updating the BUILD file every time is a tad inconvenient for the end-users who aren’t software developers, just ML folks.
I was hoping that I could at least create a
run-local
CLI alias with some global pex settings predefined.
b
p
Oh, nice! Does that work with
run
too? The doc doesn’t state that explicitly.
b
it should work with any invocation of pex, including the ones used to configure what's executed by
run
... but you'll be poking at implementation details here, where the exact commands and invocations may change from version to version (of pants)
p
I see. Will give it a shot. Thanks.
Welp, didn't work. I tried
Copy code
pants --keep-sandboxes=on_failure --pex-cli-global-args="--venv --venv-copies" run //path/to/script.py
and
Copy code
pants --keep-sandboxes=on_failure --pex-cli-global-args="--layout=packed --pre-install-wheels --venv --venv-copies" run //path/to/script.py
no luck. The sandbox has the following entries (changed the particular names to <name>)
Copy code
.python-build-standalone -> /home/<user>/.cache/pants/named_caches/python_build_standalone/
<package>.pex_pex_shim.sh*
<package>.pex_bin_python_shim.sh*
src/
.cache/
<package>.pex/
../
__run.sh*
./
pants
or
pex
didn't fail, but my script failed as before.