jolly-midnight-72759
10/12/2020, 8:34 PMipykernel
but it installs the module ipykernel_launcher
. Is there a way to teach the pex this alias or to force the "install" of particular wheels?hundreds-father-404
10/12/2020, 8:37 PMpip
?jolly-midnight-72759
10/12/2020, 8:37 PMipython...whl
installs IPython
which is an issue on macOS but might be a problem on Linux.jolly-midnight-72759
10/12/2020, 8:37 PMipykernel-5.3.4-py3-none-any.whl:
ipykernel ipykernel-5.3.4.dist-info ipykernel_launcher.py share
hundreds-father-404
10/12/2020, 8:39 PMIs there a way to teach the pex this alias or to force the “install” of particular wheels?You can use
pex req1 req2
to ensure that both are installed. Alterantively, you can use a constraints file to force a particular version of a distribution to be used, even if that distribution is a transitive dep and not explicitly specified on the CLI. pex --constraints constraints.txt req1
jolly-midnight-72759
10/12/2020, 8:40 PMjupyterlab.labapp:main
function loads ipykernel_launcher.py
. Looking at the wheel, I am guessing it isn't finding it because it is in the ipykernel
wheel.jolly-midnight-72759
10/12/2020, 8:42 PMpex -r $(pip freeze)
in a virtualenv that had JupyterLab installed. So the wheel is there. I am not sure how pex
knows about all the different scripts and modules contained in the .pex
file.hundreds-father-404
10/12/2020, 8:43 PM~/.pex/installed_wheels/my-dist-blah.whl/
, e.g. ipykernel-5.3.4-py3-none-any.whl
. This means that imports of things like ipykernel_launcher.py
should workjolly-midnight-72759
10/12/2020, 8:44 PMexec
or popen
. Let me eliminate that possibility. Thank you!hundreds-father-404
10/12/2020, 8:46 PMjolly-midnight-72759
10/12/2020, 8:53 PMenough-analyst-54434
10/12/2020, 9:41 PMenough-analyst-54434
10/12/2020, 9:45 PMjolly-midnight-72759
10/13/2020, 12:51 AMjolly-midnight-72759
10/13/2020, 12:53 AMkernel.json
files.jolly-midnight-72759
10/13/2020, 12:53 AM$PYTHONEXE -m ipykernel_launcher
.jolly-midnight-72759
10/13/2020, 12:55 AM$PATH
.enough-analyst-54434
10/13/2020, 12:57 AMjolly-midnight-72759
10/13/2020, 12:57 AMpex jupyterlab ipykernel -o jupyter-labs.pex -c jupyter-lab
jolly-midnight-72759
10/13/2020, 12:58 AMjupyterlab
into a virtenv and using the pip freeze
list. Same results.jolly-midnight-72759
10/13/2020, 12:59 AM.deps
in the pex:
Jinja2-2.11.2-py2.py3-none-any.whl nbclient-0.5.0-py3-none-any.whl
MarkupSafe-1.1.1-cp36-cp36m-macosx_10_6_intel.whl nbconvert-6.0.7-py3-none-any.whl
Pygments-2.7.1-py3-none-any.whl nbformat-5.0.7-py3-none-any.whl
Send2Trash-1.5.0-py3-none-any.whl nest_asyncio-1.4.1-py3-none-any.whl
appnope-0.1.0-py2.py3-none-any.whl notebook-6.1.4-py3-none-any.whl
argon2_cffi-20.1.0-cp36-abi3-macosx_10_15_x86_64.whl packaging-20.4-py2.py3-none-any.whl
async_generator-1.10-py3-none-any.whl pandocfilters-1.4.2-py3-none-any.whl
attrs-20.2.0-py2.py3-none-any.whl parso-0.7.1-py2.py3-none-any.whl
backcall-0.2.0-py2.py3-none-any.whl pexpect-4.8.0-py2.py3-none-any.whl
bleach-3.2.1-py2.py3-none-any.whl pickleshare-0.7.5-py2.py3-none-any.whl
certifi-2020.6.20-py2.py3-none-any.whl prometheus_client-0.8.0-py2.py3-none-any.whl
cffi-1.14.3-2-cp36-cp36m-macosx_10_9_x86_64.whl prompt_toolkit-3.0.8-py3-none-any.whl
chardet-3.0.4-py2.py3-none-any.whl ptyprocess-0.6.0-py2.py3-none-any.whl
decorator-4.4.2-py2.py3-none-any.whl pycparser-2.20-py2.py3-none-any.whl
defusedxml-0.6.0-py2.py3-none-any.whl pyparsing-2.4.7-py2.py3-none-any.whl
entrypoints-0.3-py2.py3-none-any.whl pyrsistent-0.17.3-cp36-cp36m-macosx_10_15_x86_64.whl
idna-2.10-py2.py3-none-any.whl python_dateutil-2.8.1-py2.py3-none-any.whl
importlib_metadata-2.0.0-py2.py3-none-any.whl pyzmq-19.0.2-cp36-cp36m-macosx_10_9_intel.whl
ipykernel-5.3.4-py3-none-any.whl requests-2.24.0-py2.py3-none-any.whl
ipython-7.16.1-py3-none-any.whl setuptools-50.3.0-py3-none-any.whl
ipython_genutils-0.2.0-py2.py3-none-any.whl six-1.15.0-py2.py3-none-any.whl
jedi-0.17.2-py2.py3-none-any.whl terminado-0.9.1-py3-none-any.whl
json5-0.9.5-py2.py3-none-any.whl testpath-0.4.4-py2.py3-none-any.whl
jsonschema-3.2.0-py2.py3-none-any.whl tornado-6.0.4-cp36-cp36m-macosx_10_15_x86_64.whl
jupyter_client-6.1.7-py3-none-any.whl traitlets-4.3.3-py2.py3-none-any.whl
jupyter_core-4.6.3-py2.py3-none-any.whl urllib3-1.25.10-py2.py3-none-any.whl
jupyterlab-2.2.8-py3-none-any.whl wcwidth-0.2.5-py2.py3-none-any.whl
jupyterlab_pygments-0.1.2-py2.py3-none-any.whl webencodings-0.5.1-py2.py3-none-any.whl
jupyterlab_server-1.2.0-py3-none-any.whl zipp-3.3.0-py3-none-any.whl
mistune-0.8.4-py2.py3-none-any.whl
enough-analyst-54434
10/13/2020, 12:59 AMjolly-midnight-72759
10/13/2020, 12:59 AMjolly-midnight-72759
10/13/2020, 1:00 AMmktmpenv
pip install jupyterlab
jupyter-labs
jolly-midnight-72759
10/13/2020, 1:00 AMjupyter-labs.pex
.jolly-midnight-72759
10/13/2020, 1:01 AM.js
etc).enough-analyst-54434
10/13/2020, 1:03 AMJupyterLab Error
JupyterLab application assets not found in "/usr/share/jupyter/lab"
Please run `jupyter lab build` or use a different app directory
enough-analyst-54434
10/13/2020, 1:03 AMjolly-midnight-72759
10/13/2020, 1:04 AMjolly-midnight-72759
10/13/2020, 1:04 AMcp -r share/jupyter /Users/myacct/.pyenv/versions/3.6.9/share/jupyter
jolly-midnight-72759
10/13/2020, 1:05 AMhundreds-father-404
10/13/2020, 1:11 AMjolly-midnight-72759
10/13/2020, 1:11 AMjolly-midnight-72759
10/13/2020, 1:12 AMenough-analyst-54434
10/13/2020, 1:16 AM$ ./jupyter-labs.pex --app-dir=/home/jsirois/.pex/installed_wheels/9642a3f7a665b0297c417dee9da68c8db0892eaf/jupyterlab-2.2.8-py3-none-any.whl/share/jupyter/lab
enough-analyst-54434
10/13/2020, 1:16 AMjolly-midnight-72759
10/13/2020, 1:22 AMenough-analyst-54434
10/13/2020, 1:24 AMjolly-midnight-72759
10/13/2020, 1:27 AM--app-dir
, were you able to open a console in the app and run python code? I don't think a kernel gets launched by default the first time you run.enough-analyst-54434
10/13/2020, 1:36 AMenough-analyst-54434
10/13/2020, 1:37 AMenough-analyst-54434
10/13/2020, 1:37 AM--app-dir
detection code.jolly-midnight-72759
10/13/2020, 1:39 AMJUPYTERLAB_DIR
. Can ENV variables be set dynamically to the .pex/installed_wheels/9642a3f7a665b0297c417dee9da68c8db0892eaf
directory?enough-analyst-54434
10/13/2020, 1:39 AMjupyterlab
distribution on sys.path and then exported JUPYTERLAB_DIR=...
that.jolly-midnight-72759
10/13/2020, 1:40 AMjolly-midnight-72759
10/13/2020, 1:41 AMjolly-midnight-72759
10/13/2020, 1:42 AMjolly-midnight-72759
10/13/2020, 1:43 AMenough-analyst-54434
10/13/2020, 1:43 AMenough-analyst-54434
10/13/2020, 1:43 AMjolly-midnight-72759
10/13/2020, 1:44 AMjupyter_entry_point
is the fix for that.jolly-midnight-72759
10/13/2020, 1:44 AMenough-analyst-54434
10/13/2020, 1:45 AMenough-analyst-54434
10/13/2020, 1:45 AM-c jupyterlab
jolly-midnight-72759
10/13/2020, 1:47 AMjolly-midnight-72759
10/13/2020, 1:47 AMenough-analyst-54434
10/13/2020, 1:47 AMenough-analyst-54434
10/13/2020, 1:48 AMenough-analyst-54434
10/13/2020, 1:49 AMjolly-midnight-72759
10/13/2020, 1:50 AM./pants jupyter project/src/python/projectapp
and get a notebook that can import projectapp
.enough-analyst-54434
10/13/2020, 1:51 AMjolly-midnight-72759
10/13/2020, 1:51 AMenough-analyst-54434
10/13/2020, 1:51 AMenough-analyst-54434
10/13/2020, 1:52 AMjupyter_stubber
So your pex cli example above should be doing exactly the same.jolly-midnight-72759
10/13/2020, 1:52 AMenough-analyst-54434
10/13/2020, 1:54 AMjupyter_stubber==1.0.0
jolly-midnight-72759
10/13/2020, 1:54 AMenough-analyst-54434
10/13/2020, 1:54 AM$ pex jupyter_stubber==1.0.0 -o jupyter-labs.pex -e jupyter_stubber.stubber:run --not-zip-safe
ERROR: Could not find a version that satisfies the requirement jupyter_stubber==1.0.0 (from versions: none)
ERROR: No matching distribution found for jupyter_stubber==1.0.0
jolly-midnight-72759
10/13/2020, 1:55 AMjupyter_stubber
is from our repo.jolly-midnight-72759
10/13/2020, 1:55 AMenough-analyst-54434
10/13/2020, 1:55 AMenough-analyst-54434
10/13/2020, 1:57 AMWhen I first tried my v2 plugin I worked with the original code. But I did not know how to map all the v1 types and rules to new v2 types and rules.So that makes sense. What I'm trying to point out is the Pants APIs aren't super relevant at the most basic level. At the most basic level you need to be able to create the same Pex you were creating in v1 via the Pex CLI. If you can do that it should work the same as the v1 Pex. At that point, and only at that point, you'll have apples to apples and you can go on to figuring out the new Pants APIs to use the Pex CLI.
jolly-midnight-72759
10/13/2020, 1:58 AMjolly-midnight-72759
10/13/2020, 1:59 AMpants.ini
has
jupyter_requirements: ["jupyter_stubber==1.0.0"]
enough-analyst-54434
10/13/2020, 1:59 AMjolly-midnight-72759
10/13/2020, 2:00 AMenough-analyst-54434
10/13/2020, 2:00 AMjolly-midnight-72759
10/13/2020, 2:02 AMjupyter_stubber
)?jolly-midnight-72759
10/13/2020, 2:04 AMjolly-midnight-72759
10/13/2020, 2:04 AMenough-analyst-54434
10/13/2020, 3:13 AM