Error when installing a JupyterLab extension in air-gapped environment

Hello

I’m trying to install a small Lab-extenstion in an “air-gapped” environment. I’ve updated the .npmrc with a hosted registry and disabled self-update-check for yarn. But yarn seems to still want to go to “registry.yarnpkg.com” in the “Preparing metadata” step, which it fails to do. See log below.

Is there some other setting that I have missed?

Only run “yarn install” works fine when the self-check is disabled.

Preparing metadata (pyproject.toml) ... error


  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [45 lines of output]
      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: {'build_cmd': 'build:prod', 'npm': ['jlpm']}
      INFO:hatch_jupyter_builder.utils:Installing build dependencies with npm.  This may take a while...
      INFO:hatch_jupyter_builder.utils:> /tmp/pip-build-env-i32z_peg/overlay/bin/jlpm install
      ➤ YN0000: ┌ Resolution step
      ➤ YN0001: │ RequestError: getaddrinfo ENOTFOUND registry.yarnpkg.com
          at ClientRequest.<anonymous> (/tmp/pip-build-env-i32z_peg/overlay/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:195:14340)
          at Object.onceWrapper (node:events:629:26)
          at ClientRequest.emit (node:events:526:35)
          at o.emit (/tmp/pip-build-env-i32z_peg/overlay/lib/python3.11/site-packages/jupyterlab/staging/yarn.js:190:90286)
          at TLSSocket.socketErrorListener (node:_http_client:495:9)
          at TLSSocket.emit (node:events:514:28)
          at emitErrorNT (node:internal/streams/destroy:151:8)
          at emitErrorCloseNT (node:internal/streams/destroy:116:3)
          at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
          at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26)

What extension are you installing and how? A pre-built extension wheel should not touch npm nor yarn. Is it installing from a source tarball?

Ah, sorry.

I’m trying to setup an environment for developing extentsion. So it’s from source and with pip. Trying to follow the turorial here: Extension Tutorial — JupyterLab 4.2.0b0 documentation

pip install -ve .

I’m using Artifactory as both pip-index and npm-registry.

As soon as a project/workflow diverges from the “happy path” assumed by the cookiecutter or copier template, it makes sense to do things more intentionally, referring to upstream code (like jupyterlab, jupyterlab_server, etc) where appropriate for how things actually work, rather than relying on pep517 backend magic.

Indeed, I recommend removing as much of the complexity as possible from pyproject.toml, and up to dropping hatch for the simpler flit-core or setuptools.meta.

While .npmrc might work, a .yarnc.yml with the line:

npmRegistryServer: "https://af.example.com/artifactory/yarn-example-com"

might work better. Also look at the log output: a lot of the default stuff about peer dependencies is pointless, and won’t help find what the issues are.

If the package already has a yarn.lock that references other registries, go ahead and delete that, too, as sometimes AF lags behind on things (e.g. supported hashsums, etc). If any (dependency of a) dependency uses non-standard dependencies (e.g. not @org/name) it will not go to space today without a lot of resolutions tweaking.

then run jlpm, which should reveal any crazy yarn issues.

then run jlpm build to see if something else is crazy.

Once all the node junk is clearly no longer the aggressor, pre-ensure your environment outside of the build process:

python -m pip install -r requirements-dev.txt --index-url=https://af.example.com/artifactory/pip-example-com

then try to do the pip steps, reducing as much “magic” as possible:

python -m pip install -ve . --no-deps --ignore-installed --no-build-isolation

then try to get a working development install:

jupyter labextension develop
2 Likes

Thank you @bollwyvl!

Setting npmRegistryServer helped me allong further.
The next issue was
YN0001: │ RequestError: unable to get local issuer certificate.

I managed to solve that by specifying the cafile for the yarn-config, I had it for npm already, and setting an NODE_EXTRA_CA_CERTS as an env-var.

Now I’m able to install the extension.

1 Like