JSROOT requirejs issue in Jupyterlab

Hello,

A ROOT notebook that works fine in the classic Jupyter Notebook environment does not seem to output the visualization correctly in the Jupyterlab environment. I get the following console output:

Activating jupyter-offlinenotebook JupyterLab extension
offlinenotebook.js:14 offline-notebook repoid: https://github.com/BioDynaMo/binder-demo
offlinenotebook.js:20 offline-notebook repoLabel: GitHub
offlinenotebook.js:22 offline-notebook binderRefUrl: https://github.com/BioDynaMo/binder-demo/tree/86d29d5bbc9910389695f204d2ea419618db97be
offlinenotebook.js:24 offline-notebook binderPersistentUrl: https://gesis.mybinder.org/binder/v2/gh/BioDynaMo/binder-demo/86d29d5bbc9910389695f204d2ea419618db97be
2VM129:2 Uncaught ReferenceError: requirejs is not defined
    at <anonymous>:2:2
    at t.attachWidget (index.es6.js:2758)
    at t.insertWidget (index.es6.js:2661)
    at y._insertOutput (widget.js:396)
    at y.onModelChanged (widget.js:216)
    at m (index.es6.js:459)
    at Object.c [as emit] (index.es6.js:416)
    at e.emit (index.es6.js:99)
    at c._onListChanged (model.js:231)
    at m (index.es6.js:459)
VM131:2 Uncaught ReferenceError: requirejs is not defined
    at <anonymous>:2:2
    at t.attachWidget (index.es6.js:2758)
    at t.insertWidget (index.es6.js:2661)
    at j._insertCell (widget.js:371)
    at widget.js:312
    at c (index.es6.js:1561)
    at j._onCellsChanged (widget.js:311)
    at m (index.es6.js:459)
    at Object.c [as emit] (index.es6.js:416)
    at e.emit (index.es6.js:99)
3default.js:997 Exception opening new comm
_handleCommOpen @ default.js:997
VM132:2 Uncaught ReferenceError: requirejs is not defined
    at <anonymous>:2:2
    at t.attachWidget (index.es6.js:2758)
    at t.insertWidget (index.es6.js:2661)
    at t.addWidget (index.es6.js:2630)
    at n.t.addWidget (index.es6.js:3426)
    at index.js:1964

I found that a summer student worked on this, and mentioned he fixed this issue: https://cds.cern.ch/record/2687923. I saw that his pull request was merged upstream, but the error unfortunately is still there.

Here’s the link to the failing Jupyterlab notebook: https://mybinder.org/v2/gh/BioDynaMo/binder-demo/master?urlpath=lab/tree/cell_division.ipynb

Btw, I also tried it locally, and it gives the same error. I also tried installing requirejs through npm install -g requirejs, but no succes.

@linev, sorry to ping you again, but do you have any suggestions?

Cheers,
Ahmad


ROOT Version: 6.18.04
Platform: Ubuntu 20.04


Hi,

Sorry, I have no experience with JupyterLab. We should wait for @etejedor when he is back from vacations.

For me is not clear why require.js should be loaded.
If it is not there, one should directly load JSRootCore.js script - all other necessary components will be loaded by internal JSROOT loader

Regards,
Sergey

Thanks for your quick reply Sergey! Ah I didn’t know JSROOT has an internal backup loader for its components… I thought it purely relied on requirejs for that. Ok, let’s wait for @etejedor then :slight_smile:

From the Jupyter forum I got to hear that the Jupyterlab version used in the summer student report was 1.x. The latest 2.x versions have some breaking changes, which are documented here: https://discourse.jupyter.org/t/requirejs-bug-in-jupyterlab/5518/3

I’m not familiar enough with the web-development world to know if this is anyhow related to the issue at hand, but I just wanted to provide more information that could help fix this issue. Maybe it will
help @etejedor out some way :wink:

Thank you for reporting the issue, it seems a failure to use requirejs (Jupyter provides it, JupyterLab not anymore) and the solution provided by the summer student was working, perhaps JupyterLab 2.0 broke it.

We would like to make our graphics work in new JupyterLab too so we’ll tackle this at some point, can’t say when though.

Ok thanks. For now we’ll try to use an older jupyterlab version to make it compatible with the JSROOT visualization.

Do you know why JSROOT doesn’t pick up its internal loader like @linev was expecting?

Hi,

We still do not have proper version for JupyterLab.
Central problem - correct loading of JSRootCore.js script at the first time when it required.
Once it is done - everything else should be straightforward.

Regards,
Sergey

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.