quaint-forest-8735
08/18/2022, 2:33 PMpex
executable for pants_jupyter_plugin
instead of fetching it from GitHub? (ie. https://github.com/pantsbuild/pants-jupyter-plugin/blob/ae67015a7d011315973ccc4416fdabd115a79197/pants_jupyter_plugin/pex.py#L45-L50)
We were attempting to use pex + pants_jupyter_plugin to isolate user notebook dependencies from the python environment used to launch jupyter notebook server in a deployment that was behind a heavily restricted firewall (that in particular was denying access to <http://github.com|github.com>
& *.<http://githubusercontent.com|githubusercontent.com>
), and the kernel failed to connect if the pex executable wasn't present on startup. Unfortunately we needed to stop using this in the near-term to unblock, but would love to figure out a path forward since using pex to isolate nb deps is pretty ideal for usenough-analyst-54434
08/18/2022, 2:54 PMquaint-forest-8735
08/18/2022, 2:55 PMenough-analyst-54434
08/18/2022, 2:55 PMquaint-forest-8735
08/18/2022, 2:55 PMenough-analyst-54434
08/18/2022, 2:56 PMenough-analyst-54434
08/18/2022, 2:56 PMquaint-forest-8735
08/18/2022, 2:57 PMquaint-forest-8735
08/18/2022, 2:58 PMquaint-forest-8735
08/18/2022, 2:58 PMenough-analyst-54434
08/18/2022, 2:59 PMsys.path.append("/the/pex")
import __pex__
import thing.in.pex
Or:
sys.path.append("/the/pex")
from __pex__ import thing.in.pex
No special support is needed at all.quaint-forest-8735
08/18/2022, 2:59 PMenough-analyst-54434
08/18/2022, 2:59 PMquaint-forest-8735
08/18/2022, 2:59 PMenough-analyst-54434
08/18/2022, 3:00 PMquaint-forest-8735
08/18/2022, 3:00 PMenough-analyst-54434
08/18/2022, 3:00 PMquaint-forest-8735
08/18/2022, 3:00 PMquaint-forest-8735
08/18/2022, 11:19 PMlib
in the script loading the pex, but the pex contained v1 of lib
, which version of lib
would be present in the environment after updating the `sys.path`/using the from __pex__
importquaint-forest-8735
08/18/2022, 11:20 PMenough-analyst-54434
08/19/2022, 12:11 AMsys.path.append("/path/to/pex")
the Pex will be looked in last by the Python import system, if you instead `sys.path.insert(0, "/path/to/pex")`it'll be asked 1st.enough-analyst-54434
08/19/2022, 12:13 AMsys.modules
- the import cache.