Jupyter lab build hangs and then fails at webpack --config webpack.prod.minimize.config.js

I am trying to install git extension (jupyterlab/git) for my EC2 (t2.micro) JupyterLab . In the process when I run jupyter lab build it hangs for a long time and eventually fails .

Versions :

[root@ip-10-0-0-86 Jupyter]# jupyter-lab --version
2.2.8
[root@ip-10-0-0-86 Jupyter]# node --version
v14.11.0

Error in log :

$ ensure-max-old-space webpack --config webpack.prod.minimize.config.js
child_process.js:637
    throw err;
    ^

Error: Command failed: /root/anaconda3/share/jupyter/lab/staging/node_modules/.bin/webpack --config webpack.prod.minimize.config.js

Entire log :
Building jupyterlab assets (build:prod:minimize)
An error occured.
RuntimeError: JupyterLab failed to build
See the log file for details: /tmp/jupyterlab-debug-ea1w2u3r.log

[LabBuildApp] Node v14.11.0

[LabBuildApp] Yarn configuration loaded.
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
[LabBuildApp] > node /root/anaconda3/lib/python3.6/site-packages/jupyterlab/staging/yarn.js install --non-interactive
[LabBuildApp] yarn install v1.21.1
[1/5] Validating package.json…
[2/5] Resolving packages…
success Already up-to-date.
Done in 1.14s.

[LabBuildApp] > node /root/anaconda3/lib/python3.6/site-packages/jupyterlab/staging/yarn.js run build:prod:minimize
[LabBuildApp] yarn run v1.21.1
$ ensure-max-old-space webpack --config webpack.prod.minimize.config.js
child_process.js:637
throw err;
^

Error: Command failed: /root/anaconda3/share/jupyter/lab/staging/node_modules/.bin/webpack --config webpack.prod.minimize.config.js
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:15)
at Object. (/root/anaconda3/share/jupyter/lab/staging/node_modules/@jupyterlab/buildutils/lib/ensure-max-old-space.js:38:17)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
status: null,
signal: ‘SIGKILL’,
output: [ null, null, null ],
pid: 25531,
stdout: null,
stderr: null
}
error Command failed with exit code 1.
info Visit yarn run | Yarn for documentation about this command.

[LabBuildApp] JupyterLab failed to build
[LabBuildApp] Traceback (most recent call last):

[LabBuildApp] File “/root/anaconda3/lib/python3.6/site-packages/jupyterlab/debuglog.py”, line 47, in debug_logging
yield

I tried setting export NODE_OPTIONS=“–max-old-space-size=2048” , --dev-build=False --minimize=True etc as suggested in some other threads . But nothing seem to help. Any pointers would be really helpful.

Thanks
Thomas

I’ve run out of memory before building Jupyter Lab. I had to use a larger server to build it.

Minimization takes a lot of memory. You could try with --minimize False to see if it helps.

1 Like

I had tried minimize False also but still fails. Is it possible to build certain extensions alone.

I have the following extensions installed -
[root@ip-10-0-0-86 ec2-user]# jupyter labextension list
JupyterLab v2.2.8
Known labextensions:
app dir: /root/anaconda3/share/jupyter/lab
@jupyterlab/git v0.21.1 enabled OK
nbdime-jupyterlab v2.0.0 enabled OK

Build recommended, please run jupyter lab build:
nbdime-jupyterlab needs to be included in build
@jupyterlab/git needs to be included in build

So can I build only those nbdime-jupyterlab and jupyterlab/git?

Running with --minimize=False (I freed up as much memory as I could on my AWS EC2 t2.mico), there is no hang now but after a while build fails with same error .

[root@ip-10-0-0-86 Jupyter]# jupyter lab build --minimize=False
[LabBuildApp] JupyterLab 2.2.8
[LabBuildApp] Building in /root/anaconda3/share/jupyter/lab
[LabBuildApp] Building jupyterlab assets (build:prod)
Build failed.

In the log the only failures I see are :

[LabBuildApp] > node /root/anaconda3/lib/python3.6/site-packages/jupyterlab/staging/yarn.js yarn-deduplicate -s fewer --fail [LabBuildApp] yarn run v1.21.1
$ /root/anaconda3/share/jupyter/lab/staging/node_modules/.bin/yarn-deduplicate -s fewer --fail
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
:
:

[LabBuildApp] > node /root/anaconda3/lib/python3.6/site-packages/jupyterlab/staging/yarn.js run build:prod
[LabBuildApp] yarn run v1.21.1
$ ensure-max-old-space webpack --config webpack.prod.config.js
child_process.js:637
throw err;
^

Error: Command failed: /root/anaconda3/share/jupyter/lab/staging/node_modules/.bin/webpack --config webpack.prod.config.js
** at checkExecSyncError (child_process.js:616:11)**
** at Object.execFileSync (child_process.js:634:15)**
** at Object. (/root/anaconda3/share/jupyter/lab/staging/node_modules/@jupyterlab/buildutils/lib/ensure-max-old-space.js:38:17)**
** at Module._compile (internal/modules/cjs/loader.js:1076:30)**
** at Object.Module._extensions…js (internal/modules/cjs/loader.js:1097:10)**
** at Module.load (internal/modules/cjs/loader.js:941:32)**
** at Function.Module._load (internal/modules/cjs/loader.js:782:14)**
** at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)**
** at internal/main/run_main_module.js:17:47 {**
** status: null,**
** signal: ‘SIGKILL’,**
** output: [ null, null, null ],**
** pid: 12135,**
** stdout: null,**
** stderr: null**
}

[root@ip-10-0-0-86 Jupyter]# **free -mh**
              total        used        free      shared  buff/cache   available
Mem:           983M         64M        834M        408K         84M        807M
Swap:            0B          0B          0B

[root@ip-10-0-0-86 Jupyter]# echo $NODE_OPTIONS
–max-old-space-size=4096

I am only installing @jupyterlab-git extension not multiple extensions.

Any pointers would be helpful.

regards,
Thomas

You could try adding swap if it’s still running OOM. But I’d recommend running on a larger server.

Thank you for the responses. As it is not feasible right now for me to move to a bigger server, I want to remove the extensions that started it all (and use the terminal for Git ). But when I try to uninstall the extension it finally re-builds and goes into the same loop erroring out .

[root@ip-10-0-0-86 /]# jupyter labextension uninstall --all
Uninstalling nbdime-jupyterlab from /root/anaconda3/share/jupyter/lab/extensions
Uninstalling @jupyterlab/git from /root/anaconda3/share/jupyter/lab/extensions
Building jupyterlab assets (build:prod:minimize)
An error occured.
RuntimeError: JupyterLab failed to build
See the log file for details:  /tmp/jupyterlab-debug-r_zld6j5.log

And the log shows the same error on 
$ ensure-max-old-space webpack --config webpack.prod.config.js
child_process.js:637
throw err;

For getting the git extension I installed npm, nodejs and the git extension.

Now how can I go remove the lab extension (and webpack) from the build. I want to go back to my working jupyterlab install (without extension) ? Do I have to re-install jupyterlab? If so can someone give the clean way to un-install /re-install.

Thanks
Thomas

Thanks. This worked nicely for me.

jupyter labextension install @jupyter-widgets/jupyterlab-manager --minimize=False

Rich

You can use the --no-build switch to do install or uninstall operations without a rebuild, then rebuild at the end of your operations.