Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for building with jupyterlab4 #70

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Update for building with jupyterlab4 #70

wants to merge 6 commits into from

Conversation

cmd-ntrf
Copy link
Owner

No description provided.

@cmd-ntrf cmd-ntrf self-assigned this May 16, 2024
@cmd-ntrf
Copy link
Owner Author

image

It works! There is a small issue with the icon, but otherwise it appears to works fine.

@mahendrapaipuri
Copy link
Contributor

@cmd-ntrf Glad you initiated this migration. Actually we can simplify a lot for JupyterLab 4. There wont be any need to have notebook extension separately for JupyterLab 4/Notebook 7. We can move all the code into extension directory. I have already done it for our internal implemntation that we use (https://gitlab.com/idris-cnrs/jupyter/jupyterlab/jupyterlab-env-modules/-/commit/2cc790ca7e4c9c01860c6e91f56ce782c42cedef).

I can give you a hand if you need for this part.

@lexming
Copy link
Contributor

lexming commented May 17, 2024

@cmd-ntrf Thanks for the quick update. I'm having some trouble to build this PR with node.js v20 + JupyterLavb 4.2.0. I get the following error:

pyproject-build
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - hatch-jupyter-builder >=0.5
  - hatch-nodejs-version
  - hatchling >=1.4.0
  - jupyterlab >=4.0.0
* Getting build dependencies for sdist...
* Installing packages in isolated environment:
  - hatch-jupyter-builder>=0.8.2
* Building sdist...
INFO:hatch_jupyter_builder.utils:Running jupyter-builder
INFO:hatch_jupyter_builder.utils:Building with hatch_jupyter_builder.npm_builder
INFO:hatch_jupyter_builder.utils:With kwargs: {'path': '.', 'build_cmd': 'build:prod', 'editable_build_cmd': 'build', 'npm': ['jlpm']}
INFO:hatch_jupyter_builder.utils:Installing build dependencies with npm.  This may take a while...
INFO:hatch_jupyter_builder.utils:> /user/brussel/101/vsc10122/easybuild/install/zen4/software/JupyterLab/4.2.0-GCCcore-12.3.0/bin/jlpm install
➤ YN0000: ┌ Resolution step
➤ YN0061: │ abab@npm:2.0.6 is deprecated: Use your platform's native atob() and btoa() methods instead
➤ YN0002: │ @jupyterlab/services@npm:7.2.0 doesn't provide react (p5d9ae), requested by @jupyterlab/settingregistry
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 5s 262ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ wrap-ansi@npm:8.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ wrappy@npm:1.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ ws@npm:8.17.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ y-protocols@npm:1.0.6 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yjs@npm:13.6.15 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 1s 253ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ @fortawesome/fontawesome-free@npm:5.15.4 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 1s 964ms
➤ YN0000: Done with warnings in 8s 556ms
INFO:hatch_jupyter_builder.utils:> /user/brussel/101/vsc10122/easybuild/install/zen4/software/JupyterLab/4.2.0-GCCcore-12.3.0/bin/jlpm run build:prod
Type Error: Cannot read properties of undefined (reading '/rhea/scratch/brussel/vo/000/bvo00005/vsc10122/easybuild/install/zen4/build/jupyterlmod/5.0.0/GCCcore-12.3.0/jupyter-lmod-jupyterlab4/.pnp.cjs')
    at a4 (/rhea/scratch/brussel/vo/000/bvo00005/vsc10122/easybuild/install/zen4/software/JupyterLab/4.2.0-GCCcore-12.3.0/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:390:12692)
    at i0e (/rhea/scratch/brussel/vo/000/bvo00005/vsc10122/easybuild/install/zen4/software/JupyterLab/4.2.0-GCCcore-12.3.0/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:390:13173)
    at Object.pf (/rhea/scratch/brussel/vo/000/bvo00005/vsc10122/easybuild/install/zen4/software/JupyterLab/4.2.0-GCCcore-12.3.0/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:390:13402)
    at /rhea/scratch/brussel/vo/000/bvo00005/vsc10122/easybuild/install/zen4/software/JupyterLab/4.2.0-GCCcore-12.3.0/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:694:4608
    at Object.Fa (/rhea/scratch/brussel/vo/000/bvo00005/vsc10122/easybuild/install/zen4/software/JupyterLab/4.2.0-GCCcore-12.3.0/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:390:10714)
    at ml.findPackageLocation (/rhea/scratch/brussel/vo/000/bvo00005/vsc10122/easybuild/install/zen4/software/JupyterLab/4.2.0-GCCcore-12.3.0/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:694:4563)
    at /rhea/scratch/brussel/vo/000/bvo00005/vsc10122/easybuild/install/zen4/software/JupyterLab/4.2.0-GCCcore-12.3.0/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:423:1264
    at Function.from (<anonymous>)
    at RB (/rhea/scratch/brussel/vo/000/bvo00005/vsc10122/easybuild/install/zen4/software/JupyterLab/4.2.0-GCCcore-12.3.0/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:423:1008)
    at f7 (/rhea/scratch/brussel/vo/000/bvo00005/vsc10122/easybuild/install/zen4/software/JupyterLab/4.2.0-GCCcore-12.3.0/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:423:1589)

Which is a very unhelpful error, as .pnp.js is an autogenerated file in compact format. Are you using a different version of nodejs? Or is there anything I can do to troubleshoot this.

@mahendrapaipuri
Copy link
Contributor

@lexming Use node-modules linker for yarn. You will have to add a .yarnrc.yml file in the root of the repo with contents:

enableImmutableInstalls: false
nodeLinker: node-modules

And retry building. Ensure to remove all the .pnp related stuff before.

@cmd-ntrf We will need to add this config file to repo and it should not be ignored.

@lexming
Copy link
Contributor

lexming commented May 17, 2024

@mahendrapaipuri Thanks for feedback. I needed to manually install react with npm. Then yarn install && yarn build works.

I guess that this is related to the warning from yarn install:

➤ YN0002: │ @jupyterlab/services@npm:7.2.0 doesn't provide react (p5d9ae), requested by @jupyterlab/settingregistry

Apparently somewhere in the jupyterlab stack there is a dependency missing on react. So not really an issue from jupyterlab-lmod itself.

@mahendrapaipuri
Copy link
Contributor

This is the side-effect of this new PnP linker and by using node-modules linker we get legacy beahviour of yarn package resolution and installation. This is new stuff in Yarn 3 and that is why we need to use the config file to force legacy behaviour!

@lexming
Copy link
Contributor

lexming commented May 21, 2024

@cmd-ntrf I made a new PR to the branch of this PR fixing the issue with the icon. See #72

add custom Lmod/Tmod SVG icons for JupyterLab extension
@jvhaarst
Copy link

jvhaarst commented Sep 7, 2024

In case somebody else wants to have a working jupyter-lmod with jupyterlab4, this is my recipe:

git clone https://github.com/cmd-ntrf/jupyter-lmod.git
cd jupyter-lmod/
git checkout remotes/origin/jupyterlab4
echo "enableImmutableInstalls: false" >> .yarnrc.yml
echo "nodeLinker: node-modules" >> .yarnrc.yml
cd -
python3 -m pip install ./jupyter-lmod/

(I run this in a venv to not pollute the system)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants