flox icon indicating copy to clipboard operation
flox copied to clipboard

Some Jupyter notebook extensions aren't found

Open zmitchell opened this issue 1 year ago • 9 comments

Given this manifest:

version = 1

[install]
psycopg.pkg-path = "python312Packages.psycopg"
tqdm.pkg-path = "python312Packages.tqdm"
datasets.pkg-path = "python312Packages.datasets"
ipywidgets.pkg-path = "python312Packages.ipywidgets"
huggingface-hub.pkg-path = "python312Packages.huggingface-hub"
jupyterlab-widgets.pkg-path = "python312Packages.jupyterlab-widgets"
nodejs.pkg-path = "nodejs"
widgetsnbextension.pkg-path = "python312Packages.widgetsnbextension"
pip.pkg-path = "python312Packages.pip"
jupyter.pkg-path = "jupyter"
btop.pkg-path = "btop"
postgresql_15.pkg-path = "postgresql_15"
tmux.pkg-path = "tmux"
ripgrep.pkg-path = "ripgrep"

[options]
systems = ["aarch64-darwin", "x86_64-darwin", "aarch64-linux", "x86_64-linux"]

If you activate the environment and try to list the extensions available to jupyter, it will not list all of the installed extensions:

$ flox activate
$ jupyter labextensions list
`sys_prefix` level settings are read-only, using `user` level for migration to `lockedExtensions`
JupyterLab v4.2.4
/nix/store/ni927g0pp68wmkbmanw5x5z92d91zgna-python3-3.12.5-env/share/jupyter/labextensions
        jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)
        @jupyter-notebook/lab-extension v7.2.1 enabled OK

Note that jupyterlab-widgets is not included in this list.

zmitchell avatar Sep 06 '24 16:09 zmitchell

While investigating I noticed that the path $FLOX_ENV/share/jupyter/labextensions contains all three plugins:

❯ ls $FLOX_ENV/share/jupyter/labextensions
@jupyter-notebook  @jupyter-widgets  jupyterlab_pygments

However, the two that are listed by jupyter labextensions list are contained in the same store path (along with python), whereas the plugin that isn't listed is found in a different store path:

❯ readlink "$FLOX_ENV/share/jupyter/labextensions/@jupyter-notebook"
/nix/store/ni927g0pp68wmkbmanw5x5z92d91zgna-python3-3.12.5-env/share/jupyter/labextensions/@jupyter-notebook
❯ readlink "$FLOX_ENV/share/jupyter/labextensions/jupyterlab_pygments"
/nix/store/ni927g0pp68wmkbmanw5x5z92d91zgna-python3-3.12.5-env/share/jupyter/labextensions/jupyterlab_pygments
❯ readlink "$FLOX_ENV/share/jupyter/labextensions/@jupyter-widgets"
/nix/store/lcgcbxvdzdvm3dgh4h9j6bgcl7v70imp-python3.12-jupyterlab-widgets-3.0.11/share/jupyter/labextensions/@jupyter-widgets

I suspected that jupyter was created as a wrapper that was setting a PATH-like variable to something other than this directory, so I tried to inspect that program:

$ cat $(readlink $(which jupyter))
...

# ------------------------------------------------------------------------------------
# The C-code for this binary wrapper has been generated using the following command:


makeCWrapper '/nix/store/vzbsac9730z3hgpd3gbng3b0c5g6lx3y-python3.12-jupyter-core-5.7.2/bin/jupyter' \
    --set 'NIX_PYTHONPREFIX' '/nix/store/ni927g0pp68wmkbmanw5x5z92d91zgna-python3-3.12.5-env' \
    --set 'NIX_PYTHONEXECUTABLE' '/nix/store/ni927g0pp68wmkbmanw5x5z92d91zgna-python3-3.12.5-env/bin/python3.12' \
    --set 'NIX_PYTHONPATH' '/nix/store/ni927g0pp68wmkbmanw5x5z92d91zgna-python3-3.12.5-env/lib/python3.12/site-packages' \
    --set 'PYTHONNOUSERSITE' 'true' \
    --set 'JUPYTER_PATH' '/nix/store/v3mzr6ykas796m5lpcvkw0lplq0lc78w-jupyter-kernels'
...

JUPYTER_PATH is described here and sounds like it should be pointed at the directory containing all of the plugins, but here it's pointed at a completely different store path. I had tried setting JUPYTER_PATH=$FLOX_ENV/share/jupyter/labextensions:$JUPYTER_PATH for a jupyter labextensions list call, but it made no difference.

Looking at the store path that JUPYTER_PATH currently points to, it contains a single directory with this file: kernels/python3/kernel.json. The contents are below:

❯ cat /nix/store/v3mzr6ykas796m5lpcvkw0lplq0lc78w-jupyter-kernels/kernels/python3/kernel.json | jq
{
  "argv": [
    "/nix/store/7zfypw0jpc70pxwp8w8lfrkx7psl85l9-python3-3.12.5-env/bin/python3.12",
    "-m",
    "ipykernel_launcher",
    "-f",
    "{connection_file}"
  ],
  "displayName": "Python 3",
  "display_name": "Python 3",
  "language": "python",
  "logo32": "/nix/store/7zfypw0jpc70pxwp8w8lfrkx7psl85l9-python3-3.12.5-env/lib/python3.12/site-packages/ipykernel/resources/logo-32x32.png",
  "logo64": "/nix/store/7zfypw0jpc70pxwp8w8lfrkx7psl85l9-python3-3.12.5-env/lib/python3.12/site-packages/ipykernel/resources/logo-64x64.png"
}

You can see that the program that this launches (inspecting argv) is /nix/store/7zfypw0jpc70pxwp8w8lfrkx7psl85l9-python3-3.12.5-env/bin/python3.12, which is the Python binary from the store path that also contains the two plugins that do show up.

zmitchell avatar Sep 06 '24 16:09 zmitchell

I moved to Linux so I can run strace and found a different wrapper than what's shown above:

❯ cat /nix/store/wf7fjhy0w63di1mj91xniz462lavwf5i-python3.12-jupyter-core-5.7.2/bin/.jupyter-wrapped
#!/nix/store/pgb120fb7srbh418v4i2a70aq1w9dawd-python3-3.12.5/bin/python3.12
# -*- coding: utf-8 -*-
import sys;import site;import functools;sys.argv[0] = '/nix/store/wf7fjhy0w63di1mj91xniz462lavwf5i-python3.12-jupyter-core-5.7.2/bin/jupyter';functools.reduce(lambda k, p: site.addsitedir(p, k), ['/nix/store/wf7fjhy0w63di1mj91xniz462lavwf5i-python3.12-jupyter-core-5.7.2/lib/python3.12/site-packages','/nix/store/yar69b48vc5nfz5swbyfp1mj7bl2anvz-python3.12-platformdirs-4.2.2/lib/python3.12/site-packages','/nix/store/w2vkiy06sw03i5kn48l8a0inpilf0x2q-python3.12-traitlets-5.14.3/lib/python3.12/site-packages'], site._init_pathinfo());
import re
import sys
from jupyter_core.command import main
if __name__ == "__main__":
    sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
    sys.exit(main())

That wrapper essentially adds the following directories to the module search path:

/nix/store/wf7fjhy0w63di1mj91xniz462lavwf5i-python3.12-jupyter-core-5.7.2/lib/python3.12/site-packages
/nix/store/yar69b48vc5nfz5swbyfp1mj7bl2anvz-python3.12-platformdirs-4.2.2/lib/python3.12/site-packages
/nix/store/w2vkiy06sw03i5kn48l8a0inpilf0x2q-python3.12-traitlets-5.14.3/lib/python3.12/site-packages

I'm not sure this is what we're looking for though because none of those paths contain the extensions.

zmitchell avatar Sep 06 '24 16:09 zmitchell

There's apparently another wrapper just for jupyter-labextensions: /nix/store/jdaydbij5skwjlijmi350yc8vzlw0zhd-python3.12-jupyterlab-4.2.4/bin/.jupyter-labextension-wrapped. It adds the following paths:

/nix/store/jdaydbij5skwjlijmi350yc8vzlw0zhd-python3.12-jupyterlab-4.2.4/lib/python3.12/site-packages
/nix/store/4cr7klvv2gi8cw89k84yxcip0g2h4vf9-python3.12-async-lru-2.0.4/lib/python3.12/site-packages
/nix/store/h7vb6dn9j1hy6h549d2212nibaqmm8r3-python3.12-httpx-0.27.0/lib/python3.12/site-packages
/nix/store/9md8rwwy3cggb2p13g5lan86v3vml257-python3.12-anyio-4.4.0/lib/python3.12/site-packages
/nix/store/sfq7plx1fiz435p8zjz4qdbd38vg4anj-python3.12-idna-3.7/lib/python3.12/site-packages
/nix/store/lqvkpv7znlridr8b17zf2w6grmz41vp0-python3.12-sniffio-1.3.1/lib/python3.12/site-packages
/nix/store/lv15r18cyqk2mxrgvhhcmiq5lmfmqsp9-python3.12-certifi-2024.07.04/lib/python3.12/site-packages
/nix/store/p1rvcyr7590wpz95mpayhx3bk8na9m9m-python3.12-httpcore-1.0.5/lib/python3.12/site-packages
/nix/store/msv5zpz7mjczsj37xs4gxwfxsid8q7ya-python3.12-h11-0.14.0/lib/python3.12/site-packages
/nix/store/32q6cvqyhfk7jxhpk2csr8xfxcd20dhw-python3.12-packaging-24.1/lib/python3.12/site-packages
/nix/store/8l1hrbill4dnfhnzq64m9cblblh9iy41-python3.12-tornado-6.4.1/lib/python3.12/site-packages
/nix/store/40a9zkl8sl6j31ab6h66d09my46prxp4-python3.12-ipykernel-6.29.5/lib/python3.12/site-packages
/nix/store/s53lqjsx3r783ygb0pcsgapdffnssbpf-python3.12-comm-0.2.2/lib/python3.12/site-packages
/nix/store/w2vkiy06sw03i5kn48l8a0inpilf0x2q-python3.12-traitlets-5.14.3/lib/python3.12/site-packages
/nix/store/wvrvvqcaf8x6nfpywh5a0srhnak93z0b-python3.12-debugpy-1.8.5/lib/python3.12/site-packages
/nix/store/rds9plbsj4a10lbk8gix3s442vm3rxgz-python3.12-ipython-8.26.0/lib/python3.12/site-packages
/nix/store/8kqx5v1gzrww3czy9cqyzf3bg0as1mdz-python3.12-decorator-5.1.1/lib/python3.12/site-packages
/nix/store/mh1n7adicgqb27b244qdyphbwd1x9ad6-python3.12-jedi-0.19.1/lib/python3.12/site-packages
/nix/store/fr9n1vrm47yz5qabc1v4gkrkpsxl9z0j-python3.12-parso-0.8.4/lib/python3.12/site-packages
/nix/store/ychj5rwd6jgk1l9vz2z0nyj0igi24pqs-python3.12-matplotlib-inline-0.1.7/lib/python3.12/site-packages
/nix/store/7nakpknp7gkl1k4bfm8wwz9303w8pys4-python3.12-pexpect-4.9.0/lib/python3.12/site-packages
/nix/store/wx9krkmg3bmhhxzrf7px57l7kwzyx6iy-python3.12-ptyprocess-0.7.0/lib/python3.12/site-packages
/nix/store/h8dd97wqaqhikw82dmd802qkkwkcjxhy-python3.12-prompt-toolkit-3.0.47/lib/python3.12/site-packages
/nix/store/mcfz6c3wd021qaxhaa3ci7wwnc6g4y2h-python3.12-six-1.16.0/lib/python3.12/site-packages
/nix/store/pvsn41msb8zdqsyiq7m3kkvds1jrjzik-python3.12-wcwidth-0.2.13/lib/python3.12/site-packages
/nix/store/d711x132llvbjv42a9zaldd9vrs940xh-python3.12-pygments-2.18.0/lib/python3.12/site-packages
/nix/store/410yz5lb4rv03g32hfh0bdcf1ja1hpp6-python3.12-stack-data-0.6.3/lib/python3.12/site-packages
/nix/store/z95nsdihfcqiz2z4jqm8d8w7dg2r6w4j-python3.12-asttokens-2.4.1/lib/python3.12/site-packages
/nix/store/j4s012wjjzac59kn7frljlgqmkicg80p-python3.12-executing-2.0.1/lib/python3.12/site-packages
/nix/store/njci253nqahgx2nvrgprawjp24m971ha-python3.12-pure_eval-0.2.2/lib/python3.12/site-packages
/nix/store/qg2a21lkh4nc63z6fsy12blslkvi7maw-python3.12-toml-0.10.2/lib/python3.12/site-packages
/nix/store/1m1injdjy2xi0fdvss4yfi45347cc2rf-python3.12-jupyter-client-8.6.2/lib/python3.12/site-packages
/nix/store/wf7fjhy0w63di1mj91xniz462lavwf5i-python3.12-jupyter-core-5.7.2/lib/python3.12/site-packages
/nix/store/yar69b48vc5nfz5swbyfp1mj7bl2anvz-python3.12-platformdirs-4.2.2/lib/python3.12/site-packages
/nix/store/665991phz2nxcmbzb491i6y1qk734vc1-python3.12-python-dateutil-2.9.0.post0/lib/python3.12/site-packages
/nix/store/q1ac7al84ifif5wybkqa1xnw1cyhh21p-python3.12-pyzmq-26.0.3/lib/python3.12/site-packages
/nix/store/bj4clpnx19kmzxy0flnhx88x825mcbfj-python3.12-nest-asyncio-1.6.0/lib/python3.12/site-packages
/nix/store/bckllnkh2j1ddfgp89qhclvqszhvkdmm-python3.12-psutil-6.0.0/lib/python3.12/site-packages
/nix/store/1d7qqndk418s26vxl3bx5bmmsl535w9i-python3.12-jupyter-lsp-2.2.5/lib/python3.12/site-packages
/nix/store/27kxvws7ypv60hs197sldh6pr0ci3p2y-python3.12-jupyter-server-2.14.2/lib/python3.12/site-packages
/nix/store/q6nf8bzn37v1qwpfwyrys3d5wp9g2q0y-python3.12-argon2-cffi-23.1.0/lib/python3.12/site-packages
/nix/store/kmqgghqqay2kasjdxrq1rh9m24rlblk6-python3.12-argon2-cffi-bindings-21.2.0/lib/python3.12/site-packages
/nix/store/kdh0g0ngg2wyswd5b32x3b2h0w7khw6v-python3.12-cffi-1.17.0/lib/python3.12/site-packages
/nix/store/1apffki6hybyf5jdizcihr9m07i4f9i7-python3.12-pycparser-2.22/lib/python3.12/site-packages
/nix/store/jahk1m7inpwdp68cjr677pdgwv25s9rx-python3.12-jinja2-3.1.4/lib/python3.12/site-packages
/nix/store/a0xrmk6d51qpm59zyx1cz24rfpf2j9wd-python3.12-markupsafe-2.1.5/lib/python3.12/site-packages
/nix/store/nr5505rcwr2r99wc176cbjccpf06c9pb-python3.12-jupyter-events-0.10.0/lib/python3.12/site-packages
/nix/store/8ks99ci2hk8qfqzsd8fg2wcznl0z81wp-python3.12-jsonschema-4.22.0/lib/python3.12/site-packages
/nix/store/fyc5krc74fjca8lkv3bdfazks8ks2yxh-python3.12-attrs-23.2.0/lib/python3.12/site-packages
/nix/store/58rywcfb8n3fcwmn05jilr17qv7445ya-python3.12-jsonschema-specifications-2023.12.1/lib/python3.12/site-packages
/nix/store/5k1vhmsxz9m62szb59ibjbdr5v86y8wx-python3.12-referencing-0.34.0/lib/python3.12/site-packages
/nix/store/g1b4rcyviv5xldngyhyf0y3sphad50g0-python3.12-rpds-py-0.18.1/lib/python3.12/site-packages
/nix/store/v5ah5d47945pcmk8xm7wszs5h065vd7l-python3.12-python-json-logger-2.0.7/lib/python3.12/site-packages
/nix/store/qqgpm53hlff63rjdq4wc7msv0kx1wx21-python3.12-pyyaml-6.0.1/lib/python3.12/site-packages
/nix/store/cfj5xmijw9pnq4ga6gd3ccyjw1jaw51l-python3.12-fqdn-1.5.1/lib/python3.12/site-packages
/nix/store/wplbs9m8y6sbb4jkb0cr3q02yyzvvq0q-python3.12-isoduration-20.11.0/lib/python3.12/site-packages
/nix/store/mzhc25pl6xqpfgxcs0mn0ci1cqcxavlv-python3.12-arrow-1.3.0/lib/python3.12/site-packages
/nix/store/cb6gn2cxxwgkqr488knz4b2jps5c201s-python3.12-types-python-dateutil-2.9.0.20240316/lib/python3.12/site-packages
/nix/store/bdlwh0x6fhhmnfdyfxwwvcjqgyq9vm4l-python3.12-jsonpointer-3.0.0/lib/python3.12/site-packages
/nix/store/835mc0dr041b0jkm5lp0141a8sw58h19-python3.12-rfc3339-validator-0.1.4/lib/python3.12/site-packages
/nix/store/8h5aprc9qb7259jf75nxnjhkz16ifj1c-python3.12-rfc3986-validator-0.1.1/lib/python3.12/site-packages
/nix/store/v8kqyahxyga2h3gpa5992jidzspddlpg-python3.12-uri-template-1.3.0/lib/python3.12/site-packages
/nix/store/c1ahgbm1r1kslymgg6cskg8k34hb7mnj-python3.12-webcolors-1.13/lib/python3.12/site-packages
/nix/store/ppc49033gkir6kf4zz8bi7iv2ysq9yzv-python3.12-jupyter-server-terminals-0.5.3/lib/python3.12/site-packages
/nix/store/00lvrmp2ccfn2nz48a31rrwzszxc4y8z-python3.12-terminado-0.18.1/lib/python3.12/site-packages
/nix/store/714a6dwihcg04y3dfkjrxk8y0is565ds-python3.12-nbformat-5.10.4/lib/python3.12/site-packages
/nix/store/s8a4bmdqpml9kd3dq4ymi5y2610mw3yq-python3.12-fastjsonschema-2.19.1/lib/python3.12/site-packages
/nix/store/kxsi1azpc1zbh8j8dvh2zwpkldp6a423-python3.12-nbconvert-7.16.4/lib/python3.12/site-packages
/nix/store/d2s79sbcmb9gd7ah3fl8z9zi5l9g2wap-python3.12-beautifulsoup4-4.12.3/lib/python3.12/site-packages
/nix/store/jhinp975mcp4zyqqpfq8qn6jfcd942jp-python3.12-chardet-5.2.0/lib/python3.12/site-packages
/nix/store/31f5rkmq2grywy18nbafhx86gwnzpw61-python3.12-soupsieve-2.5/lib/python3.12/site-packages
/nix/store/33g8i7zpjvn7dm4477y7s2b6x8i0gmjw-python3.12-bleach-6.1.0/lib/python3.12/site-packages
/nix/store/563cvppq12c1g8dbvig5c0wp9v1cy12s-python3.12-html5lib-1.1/lib/python3.12/site-packages
/nix/store/virkfgvlz8jgspvcd5g9iczj8q53sqmy-python3.12-webencodings-0.5.1/lib/python3.12/site-packages
/nix/store/llgbdr264r5ih0d19ii7k5c1ankxh9sv-python3.12-setuptools-72.1.0/lib/python3.12/site-packages
/nix/store/w9mr9m3vnpra6zhd7pqln32sp1nbnmsy-python3.12-defusedxml-0.8.0rc2/lib/python3.12/site-packages
/nix/store/gwa340i69pzgfj20hpl1crg9jj1r1l22-python3.12-jupyterlab-pygments-0.3.0/lib/python3.12/site-packages
/nix/store/2353d01ymdcqw4w0mwm5wibsb6xv3c6y-python3.12-mistune-3.0.2/lib/python3.12/site-packages
/nix/store/9qg6iwfdgps8607z6r12pww6yxlypqb8-python3.12-nbclient-0.10.0/lib/python3.12/site-packages
/nix/store/jc98xbnb946gqzi76jjg25b9m5bfh8r3-python3.12-async-generator-1.10/lib/python3.12/site-packages
/nix/store/2pla492x4l4n68fhhzm2k87ynphavc3g-python3.12-pandocfilters-1.5.1/lib/python3.12/site-packages
/nix/store/qbkkyfmsbzdal96crampv588w84vk889-python3.12-tinycss2-1.3.0/lib/python3.12/site-packages
/nix/store/cmlaggjl6wybkli2fxfi1mgdgychn836-python3.12-send2trash-1.8.2/lib/python3.12/site-packages
/nix/store/d2s5fpmj541wgg03sgv0mn2pqbb8blm6-python3.12-prometheus-client-0.20.0/lib/python3.12/site-packages
/nix/store/bvy0q2x858y7by4jyhzk2jmvd6zyxqgf-python3.12-websocket-client-1.8.0/lib/python3.12/site-packages
/nix/store/hhni7ll6f532jrcwg6g9xa2ksl2gyzvp-python3.12-python-socks-2.4.4/lib/python3.12/site-packages
/nix/store/wwyym2crq0aa2qzlnvarjj40sbqvf179-python3.12-trio-0.25.0/lib/python3.12/site-packages
/nix/store/1qc8258sx5jvfvrmv5g31vm192a61lzf-python3.12-outcome-1.3.0.post0/lib/python3.12/site-packages
/nix/store/rzwp7v3i8bywal7x8l6kh7ykhcbmbdq6-python3.12-sortedcontainers-2.4.0/lib/python3.12/site-packages
/nix/store/j830xqfb1xnsv8a6pdpsw1kkmd2ypvfb-python3.12-curio-1.6/lib/python3.12/site-packages
/nix/store/5nbfcww6qkpdl53gwp11nc99bk6wf2q1-python3.12-async-timeout-4.0.3/lib/python3.12/site-packages
/nix/store/5z5cwbcxsa6zxqazdgkvpah05y8j5x2b-python3.12-typing-extensions-4.12.2/lib/python3.12/site-packages
/nix/store/lzcrp0smrjlb3xh3sy2j5lpaa2r4hpgp-python3.12-overrides-7.7.0/lib/python3.12/site-packages
/nix/store/62b227m4rmh2iz4sv7idkaypshv2ri8y-python3.12-jupyterlab-server-2.27.3/lib/python3.12/site-packages
/nix/store/1qc033cl58096fcbc3qxnqpi5rpwyshs-python3.12-babel-2.15.0/lib/python3.12/site-packages
/nix/store/ijhnn714bjal4lndbs8q3xbz4n288hd4-python3.12-json5-0.9.14/lib/python3.12/site-packages
/nix/store/v9vlasx9pvm911cxdmd5fqbical5pjx8-python3.12-requests-2.32.3/lib/python3.12/site-packages
/nix/store/hgmg45h115ir1vrad4rmyamdxznk3q4h-python3.12-brotlicffi-1.1.0.0/lib/python3.12/site-packages
/nix/store/pjhay5jwdmcw83llswi1hpp8jwwp2zjm-python3.12-charset-normalizer-3.3.2/lib/python3.12/site-packages
/nix/store/iascs8wc0g70ln13rcjbb2hr0gc1kq26-python3.12-urllib3-2.2.2/lib/python3.12/site-packages
/nix/store/nlkqpp1624rxiwsskzf41nzj20hdfhqy-python3.12-notebook-shim-0.2.4/lib/python3.12/site-packages

The /nix/store/gwa340i69pzgfj20hpl1crg9jj1r1l22-python3.12-jupyterlab-pygments-0.3.0/lib/python3.12/site-packages path is in there, but I don't see a jupyter-notebook path in there, so I'm not sure if this is meaningful.

zmitchell avatar Sep 06 '24 16:09 zmitchell

Aha!

❯ JUPYTER_DATA_DIR="$FLOX_ENV/share/jupyter" jupyter labextension list
`sys_prefix` level settings are read-only, using `user` level for migration to `lockedExtensions`
JupyterLab v4.2.4
/nix/store/ni927g0pp68wmkbmanw5x5z92d91zgna-python3-3.12.5-env/share/jupyter/labextensions
        jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)
        @jupyter-notebook/lab-extension v7.2.1 enabled OK

/Users/zmitchell/src/jupyter-flox/.flox/run/aarch64-darwin.jupyter-flox/share/jupyter/labextensions
        @jupyter-widgets/jupyterlab-manager v5.0.11 enabled OK (python, jupyterlab_widgets)

zmitchell avatar Sep 06 '24 17:09 zmitchell

I discovered a solution:

export JUPYTER_DATA_DIR="$FLOX_ENV/share/jupyter"

And you can verify that it works like this (note that jupyter-widgets is found now):

❯ JUPYTER_DATA_DIR="$FLOX_ENV/share/jupyter" jupyter labextension list
`sys_prefix` level settings are read-only, using `user` level for migration to `lockedExtensions`
JupyterLab v4.2.4
/nix/store/ni927g0pp68wmkbmanw5x5z92d91zgna-python3-3.12.5-env/share/jupyter/labextensions
        jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)
        @jupyter-notebook/lab-extension v7.2.1 enabled OK

/Users/zmitchell/src/jupyter-flox/.flox/run/aarch64-darwin.jupyter-flox/share/jupyter/labextensions
        @jupyter-widgets/jupyterlab-manager v5.0.11 enabled OK (python, jupyterlab_widgets)

zmitchell avatar Sep 06 '24 19:09 zmitchell

will fix with https://github.com/flox/flox/issues/2068

ghudgins avatar Sep 06 '24 20:09 ghudgins

Submitted a PR to respect JUPYTER_PATH in nixpkgs

mkenigs avatar Sep 18 '24 16:09 mkenigs

@zmitchell do you have a branch with WIP or something? I couldn't find a PR

mkenigs avatar Sep 30 '24 17:09 mkenigs

It's been a couple of weeks so I think I just misremembered. Essentially I would check for the existence of "$FLOX_ENV/share/jupyter" and if it exists set JUPYTER_PATH to that (or prepend it).

zmitchell avatar Sep 30 '24 17:09 zmitchell