ambitious-student-81104
09/14/2021, 1:02 AM%pex_load tmp/ml_training_env.pex
fails. I put the code and output in the thread.%ls tmp
%load_ext pants_jupyter_plugin
%pex_load tmp/ml_training_env.pex
the output is:
ml_training_env.pex
The pants_jupyter_plugin extension is already loaded. To reload it, use:
%reload_ext pants_jupyter_plugin
HTML(value='<style>.nb-console-output-tCNbr { background-color: black;} .nb-console-output-tCNbr pre { color: …
Accordion(children=(Output(layout=Layout(height='300px', overflow_y='scroll'), outputs=({'output_type': 'displ…
Scrubbing sys.path and sys.modules in preparation for pex bootstrap
sys.path contains 7 items, sys.modules contains 1249 keys
sys.path now contains 7 items, sys.modules now contains 1249 keys
---------------------------------------------------------------------------
CalledProcessError Traceback (most recent call last)
~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/pants_jupyter_plugin/plugin.py in _accordion_widget(self, title, height, collapsed)
147 # Capture the output context.
148 with outputter:
--> 149 yield expand, collapse, set_output_glyph
150
151 def _stream_binary_build_with_output(
~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/pants_jupyter_plugin/plugin.py in _bootstrap_pex(self, pex_path)
295
296 # Bootstrap pex.
--> 297 for path in self._pex.mount(pex_path):
298 self._display_line(f"added sys.path entry {path}\n")
299 except Exception:
~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/pants_jupyter_plugin/pex.py in mount(self, pex_to_mount)
129
130 selected_interpreter = json.loads(
--> 131 run_pex_tool(args=["interpreter", "-v"], stdout=subprocess.PIPE).decode()
132 )["path"]
133 if not current_interpreter.samefile(selected_interpreter):
~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/pants_jupyter_plugin/pex.py in run_pex_tool(args, **subprocess_args)
123 env=env.create(PEX_INTERPRETER=1, PEX_PYTHON_PATH=sys.executable),
124 check=True,
--> 125 **subprocess_args,
126 ).stdout
127 or b""
~/anaconda3/envs/pytorch_p36/lib/python3.6/subprocess.py in run(input, timeout, check, *popenargs, **kwargs)
436 if check and retcode:
437 raise CalledProcessError(retcode, process.args,
--> 438 output=stdout, stderr=stderr)
439 return CompletedProcess(process.args, retcode, stdout, stderr)
440
CalledProcessError: Command '['/home/ec2-user/anaconda3/envs/pytorch_p36/bin/python', '/home/ec2-user/.cache/pants_jupyter_plugin/pex/exes/pex-2.1.32.pex', '-m', 'pex.tools', 'tmp/ml_training_env.pex', 'interpreter', '-v']' returned non-zero exit status 1.
%pex_load dist/ml.ml-models.src.python.training_env/ml_training_env.pex
works locallyCalledProcessError
abovehundreds-father-404
09/14/2021, 1:16 AMexecution_mode
and/or include_tools
on the pex_binary
./pants peek path/to:pex_binary_tgt
would be helpfulambitious-student-81104
09/14/2021, 1:17 AMif you set the fieldsno i did notand/orexecution_mode
on theinclude_tools
pex_binary
pex_binary(
name="ml_training_env",
entry_point="imports.py",
dependencies=[...],
)
hundreds-father-404
09/14/2021, 1:19 AM'unzip'
and 'venv'
?enough-analyst-54434
09/14/2021, 1:20 AMambitious-student-81104
09/14/2021, 1:22 AMName: pants-jupyter-plugin
Version: 0.0.3
enough-analyst-54434
09/14/2021, 1:50 AMambitious-student-81104
09/14/2021, 1:54 AMsys.path
to the first but it still doesn't get prioritized unless I remove the other path that has those packagesrm -rf
and still didn't workenough-analyst-54434
09/14/2021, 1:56 AMambitious-student-81104
09/14/2021, 1:59 AMsys.path
. If pants-jupyter-plugin
could automatically change sys.path
to put whatever is in the loaded pex at top priority, that'll be idealenough-analyst-54434
09/14/2021, 2:00 AM%pex_load
magic.%pex_load_insert
vs %pex_load
, but I'm completely ignorant of what's possible / normal with custom magics - maybe there is a way to support something like `%pex_load --prepend ./a.pex`and have that not look totally abnormal to someone used to using these sort of things. This is where your experiene filing an issue will help alot.ambitious-student-81104
09/14/2021, 2:44 AM