python - Jupyter 实验室无法安装任何扩展 : Assertion `data' failed

标签 python node.js webpack jupyter-lab

我尝试安装@jupyter-widgets/jupyterlab-manager:

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

其他扩展也无法安装,报同样的错误。从 Web 客户端安装会出现 500 错误。

我用谷歌搜索但找不到相同的错误。此外,类似错误的解决方案似乎都不起作用。

我的环境:

Raspbian GNU/Linux 10 (buster)

$ node --version
v10.15.2

$ python3 -V
Python 3.7.3

$ jupyter --version
jupyter core     : 4.6.1
jupyter-notebook : 6.0.2
qtconsole        : 4.6.0
ipython          : 7.11.1
ipykernel        : 5.1.3
jupyter client   : 5.3.4
jupyter lab      : 1.2.6
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 5.0.3
traitlets        : 4.3.3

$ which jupyter
/usr/local/bin/jupyter

这是日志文件:

Yarn configuration loaded.
Node v10.15.2

> /usr/local/bin/npm pack @jupyter-widgets/jupyterlab-manager
npm notice 
npm notice 📦  @jupyter-widgets/jupyterlab-manager@1.1.0
npm notice === Tarball Contents === 
npm notice 2.3kB  package.json        
npm notice 1.5kB  LICENSE             
npm notice 1.9kB  README.md           
npm notice 277B   lib/index.d.ts      
npm notice 380B   lib/index.js        
npm notice 5.9kB  lib/manager.d.ts    
npm notice 14.5kB lib/manager.js      
npm notice 1.9kB  lib/output.d.ts     
npm notice 5.2kB  lib/output.js       
npm notice 830B   lib/plugin.d.ts     
npm notice 7.8kB  lib/plugin.js       
npm notice 956B   lib/renderer.d.ts   
npm notice 3.3kB  lib/renderer.js     
npm notice 216B   lib/semvercache.d.ts
npm notice 862B   lib/semvercache.js  
npm notice 375B   schema/plugin.json  
npm notice === Tarball Details === 
npm notice name:          @jupyter-widgets/jupyterlab-manager         
npm notice version:       1.1.0                                       
npm notice filename:      jupyter-widgets-jupyterlab-manager-1.1.0.tgz
npm notice package size:  12.2 kB                                     
npm notice unpacked size: 48.3 kB                                     
npm notice shasum:        6196b9e3df314d488180fb5ed3bfb11df2dfdeaf    
npm notice integrity:     sha512-2dKdzl43nMvmr[...]53y1/ADuNbzhg==    
npm notice total files:   16                                          
npm notice 
jupyter-widgets-jupyterlab-manager-1.1.0.tgz

Yarn configuration loaded.
Node v10.15.2

Building jupyterlab assets (build:prod:minimize)
> node /usr/local/lib/python3.7/dist-packages/jupyterlab/staging/yarn.js install --non-interactive
yarn install v1.15.2
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@1.2.11: The platform "linux" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
success Saved lockfile.
Done in 49.55s.

> node /usr/local/lib/python3.7/dist-packages/jupyterlab/staging/yarn.js yarn-deduplicate -s fewer
yarn run v1.15.2
$ /usr/local/share/jupyter/lab/staging/node_modules/.bin/yarn-deduplicate -s fewer
Done in 15.72s.

> node /usr/local/lib/python3.7/dist-packages/jupyterlab/staging/yarn.js run build:prod:minimize
yarn run v1.15.2
$ ensure-max-old-space webpack --config webpack.prod.minimize.config.js
/usr/bin/node[26503]: ../src/node_platform.cc:414:std::shared_ptr<node::PerIsolatePlatformData> node::NodePlatform::ForIsolate(v8::Isolate*): Assertion `data' failed.
child_process.js:637
    throw err;
    ^

Error: Command failed: /usr/local/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:13)
    at Object.<anonymous> (/usr/local/share/jupyter/lab/staging/node_modules/@jupyterlab/buildutils/lib/ensure-max-old-space.js:38:17)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

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

  File "/usr/local/lib/python3.7/dist-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

  File "/usr/local/lib/python3.7/dist-packages/jupyterlab/labextensions.py", line 105, in start
    command=command, app_options=app_options)

  File "/usr/local/lib/python3.7/dist-packages/jupyterlab/commands.py", line 459, in build
    command=command, clean_staging=clean_staging)

  File "/usr/local/lib/python3.7/dist-packages/jupyterlab/commands.py", line 669, in build
    raise RuntimeError(msg)

RuntimeError: JupyterLab failed to build

Exiting application: jupyter

最佳答案

JupyterLab 1.x 在构建之前检查内存大小(ensure-max-old-space 行),默认值为 4GB。因为我用的是树莓派,内存达不到这个要求。这就是断言失败的原因。

但是 JupyterLab 2.0.0 改变了这种行为,因为 Node 12+ 处理内存。 ( changelogPR )。我在 change swap size 之后使用 Node v10.15.2 成功构建了 JupyterLab 2.0.1|到 1000 MB(我认为 500 MB 就足够了)。

但是 JupyterLab 2.1.0,reverted that PR再次支持 Node 10+。

要绕过小于 4 GB 内存的检查,您可以:

  • 安装jupyterlab>=2.0.0,<2.1.0
  • 或设置环境变量NODE_OPTIONS=--max_old_space_size=2048 build 时。您可能希望根据您的系统将 2048 更改为适当的 MB 内存。此选项是在 1.2.0 之后添加的。

并确保你有足够的内存来构建:)

关于python - Jupyter 实验室无法安装任何扩展 : Assertion `data' failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60450528/

相关文章:

python - Python 中具有分数次幂的二项式展开

Python根据其他列(字典单词)计算出现次数

javascript - TypeScript 中的 Mongoose 方法范围

node.js - 无法使用 #!/usr/bin/env node 运行 Node 可执行文件

当我编辑文件时,webpack 2 livereload 不工作

python - 无法使用 Pandas 获取 DataFrame 列的最小值

python - 加快 Pandas 数据框中字符串的整数编码

node.js - 我应该将 AWS ECS 与 Postgres Docker 容器还是 AWS RDS 结合使用吗?

javascript - webpack 中的异步 block 是什么?

javascript - 不允许按需加载初始 block 。 block 名称 "main"已被入口点使用