jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
951 stars 188 forks source link

pythreejs under JupyterLab 0.33.6: Error: "Could not create a model." #206

Closed mprogram closed 6 years ago

mprogram commented 6 years ago

I'm getting the following trace in the Chrome console under JLab 0.33.4 + ipywidgets 7.3.1 when trying to run pythreejs examples (e.g. Animation: sphere, cube, etc.). I guess widget declaration somehow has changed in this version of JLab.

default.js:928` Exception opening new comm
(anonymous) @ default.js:928
s @ default.js:7
Promise.then (async)
l @ default.js:8
(anonymous) @ default.js:9
YC29.n @ default.js:5
_handleCommOpen @ default.js:913
(anonymous) @ default.js:1020
(anonymous) @ default.js:9
YC29.n @ default.js:5
_handleMessage @ default.js:977
_msgChain._msgChain.then @ default.js:124
Promise.then (async)
_onWSMessage.e @ default.js:121
default.js:129 Error: Object 'jupyter.widget' not found in registry
    at M.Promise (default.js:1476)
    at new Promise (<anonymous>)
    at Object.M [as loadObject] (default.js:1455)
    at y.<anonymous> (default.js:921)
    at Generator.next (<anonymous>)
    at default.js:9
    at new Promise (<anonymous>)
    at YC29.n (default.js:5)
    at y._handleCommOpen (default.js:913)
    at y.<anonymous> (default.js:1020)
    at Generator.next (<anonymous>)
    at default.js:9
    at new Promise (<anonymous>)
    at YC29.n (default.js:5)
    at y._handleMessage (default.js:977)
    at _msgChain._msgChain.then (default.js:124)
_msgChain._msgChain.then.catch.e @ default.js:129
Promise.catch (async)
_onWSMessage.e @ default.js:126
default.js:928 Exception opening new comm
(anonymous) @ default.js:928
s @ default.js:7
Promise.then (async)
l @ default.js:8
(anonymous) @ default.js:9
YC29.n @ default.js:5
_handleCommOpen @ default.js:913
(anonymous) @ default.js:1020
(anonymous) @ default.js:9
YC29.n @ default.js:5
_handleMessage @ default.js:977
_msgChain._msgChain.then @ default.js:124
Promise.then (async)
_onWSMessage.e @ default.js:121
default.js:129 Error: Object 'jupyter.widget' not found in registry
    at M.Promise (default.js:1476)
    at new Promise (<anonymous>)
    at Object.M [as loadObject] (default.js:1455)
    at y.<anonymous> (default.js:921)
    at Generator.next (<anonymous>)
    at default.js:9
    at new Promise (<anonymous>)
    at YC29.n (default.js:5)
    at y._handleCommOpen (default.js:913)
    at y.<anonymous> (default.js:1020)
    at Generator.next (<anonymous>)
    at default.js:9
    at new Promise (<anonymous>)
    at YC29.n (default.js:5)
    at y._handleMessage (default.js:977)
    at _msgChain._msgChain.then (default.js:124)
_msgChain._msgChain.then.catch.e @ default.js:129
Promise.catch (async)
_onWSMessage.e @ default.js:126
default.js:928 Exception opening new comm
(anonymous) @ default.js:928
s @ default.js:7
Promise.then (async)
l @ default.js:8
(anonymous) @ default.js:9
YC29.n @ default.js:5
_handleCommOpen @ default.js:913
(anonymous) @ default.js:1020
(anonymous) @ default.js:9
YC29.n @ default.js:5
_handleMessage @ default.js:977
_msgChain._msgChain.then @ default.js:124
Promise.then (async)
_onWSMessage.e @ default.js:121
default.js:129 Error: Object 'jupyter.widget' not found in registry
    at M.Promise (default.js:1476)
    at new Promise (<anonymous>)
    at Object.M [as loadObject] (default.js:1455)
    at y.<anonymous> (default.js:921)
    at Generator.next (<anonymous>)
    at default.js:9
    at new Promise (<anonymous>)
    at YC29.n (default.js:5)
    at y._handleCommOpen (default.js:913)
    at y.<anonymous> (default.js:1020)
    at Generator.next (<anonymous>)
    at default.js:9
    at new Promise (<anonymous>)
    at YC29.n (default.js:5)
    at y._handleMessage (default.js:977)
    at _msgChain._msgChain.then (default.js:124)
jasongrout commented 6 years ago

What version of the @jupyter-widgets/jupyterlab-manager do you have installed? jupyter labextension list

mprogram commented 6 years ago

# jupyter labextension list JupyterLab v0.33.4 Known labextensions: app dir: /usr/share/jupyter/lab ... @jupyter-widgets/jupyterlab-manager @jupyter-widgets/jupyterlab-manager v0.36.0 enabled OK ... coming with ipywidgets = 7.3.1

Working extensions are (among some): plotlywidget v0.2.0 (plotly.js 1.39.3), bqplot, etc.

jasongrout commented 6 years ago

Ah, good, so you do have some ipywidgets extensions working. IIRC, widget declaration shouldn't have changed (i.e., all the other widget jlab extensions should work just fine too).

vidartf commented 6 years ago

Just to double check, try running:

jupyter lab clean
jupyter lab build

If that doesn't change anything, you could try to inspect the objects in the web developer console where the exception occurs, and see if you can learn anything. As it is, this is rather hard to figure out remotely, unfortunately.

mprogram commented 6 years ago

I'd done that before, and re-run these lines now. I've upgraded to JLab to 0.33.6, as also to the most recent IPython, ipykernel, etc. The error is still manifest itself, as also the absence of (some) widgets functionality. I asked on ipywidgets about the diagnostic message I'm getting from a kernel ('KeyError'). Please, feel free to suggest possible solutions and further investigations. There is no helpful messages from a debug log, the abovementioned messages from the Chrome console, and uncovered 'KeyError' (with the help of kernelspy) upon actual rendering of a shere/cube from pythreejs examples. It should be as easy to replicate as installing JLab+pythreejs in a separate environment and look with a developer eye at what I'm seeing. I stumbled upon a similar message, referenced in pull no. 661 on bqplot, and two satellite errors with ipywebrtc, referenced in issue no. 14 there.

jasongrout commented 6 years ago

cf https://github.com/jupyter-widgets/ipywidgets/issues/2163 for the ipywidgets issue.

vidartf commented 6 years ago

I can reproduce, I'll have a look at it.

vidartf commented 6 years ago

I'm only able to reproduce this when I forget to install the @jupyter-widgets/jupyterlab-manager extension for lab. When I don't install this, I can reproduce the issue perfectly. Once I install it, everything works as expected. What I did basically follows this pattern:

conda create -n pythree-test pythreejs jupyterlab
conda activate pythree-test

jupyter labextension install jupyterlab-kernelspy
jupyter lab

# Run the Animation example notebook from pythreejs, reproducing the issue

jupyter labextension install @jupyter-widgets/jupyterlab-manager

# After refreshing the lab page to pick up new build, issue is now gone

The error message from the kernel is a continuation error: Once the comm manager in lab services fails to find the widgets comm target, it sends back a comm message without a method field in its content. This should probably be handled more gracefully, but doesn't currently make any difference on the end result.

mprogram commented 6 years ago

I'm reinstalling ipywidgets 7.3.2 released 19 hours ago, and I will come back shortly. BTW, I likely faced the issue(s) closed in this release on ipywidgets in pulls 2150 (for sure, as I was seeing this error in the classic notebook) and, possibly, 2146. You'd probably picked up release 7.3.2 along the way.

mprogram commented 6 years ago

ok, I assume @vidartf used jupyterlab = 0.33.6, ipywidgets = 7.3.2 from conda-forge, and jupyterlab-manager = 0.36.0 as described (it comes from npmjs with slightly outdated README.md)

This set is what I'm using, however, the python wheels are coming from pypi - repacked as the *.deb packages, and with jupyterlab-manager installed as descriibed (with an updated README.md, what is irrelevant here). Everything was also run in Chrome's incognito mode to avoid cache issues.

I have updated jupyterlab, ipywidgets/widgetsnbextension, ipykernel, pythreejs, and a number of other packages to their latest releases. As also notebook, which gave me the --debug output:

======= JupyterNotebook 1st run =======

[W 14:01:23.924 LabApp] 404 GET /static/components/proptypes/index.js.map (127.0.0.1) 34.31ms referer=None [W 14:01:23.929 LabApp] 404 GET /static/components/preact/preact.min.js.map (127.0.0.1) 3.81ms referer=None [W 14:01:23.934 LabApp] 404 GET /static/components/preact-compat/preact-compat.min.js.map (127.0.0.1) 4.73ms referer=None

…a surprise. Quick investigation revealed the notebook python wheel on pypi, indeed, lacks those files, so, I've built, and repacked, the whl-file from the master branch into the debian package, having included those counterparts. I hardly could think of people missing this step, as it is the official wheel from pypi, so, it afftects 'em all (it might have been fixed on conda-forge although).

======= JupyterNotebook 2nd run + examples/Animation.ipynb =======

TL;DR: It didn't work, neither it did under JupyterLab. What follows is the essential juxtaposition of the --debug output and the Chrome console messages:

bidi.js:19 Loaded moment locale ru Error: widgetsnbextension.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) [W 20:56:52.137 LabApp] 404 GET /nbextensions/widgetsnbextension.js?v=20180803205417 (127.0.0.1) 12.12ms referer=http://localhost:8888/notebooks/src/github.com/jupyter-widgets/pythreejs/examples/Animation.ipynb … utils.js:37 Loading extension: varInspector/main main.js?v=20180803205417:445 [varInspector] Kernel is available -- varInspector initializing utils.js:62 Failed to load extension: Array(1) Error: Script error for "nbextensions/widgetsnbextension" http://requirejs.org/docs/errors.html#scripterror at makeError (require.js?v=6da8be361b9ee26c5e721e76c6d4afce:165) at HTMLScriptElement.onScriptError (require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1732) … Error: require.js?v=6da8be361b9ee26c5e721e76c6d4afce:1952 GET http://localhost:8888/nbextensions/widgets/notebook/js/extension.js?v=20180803205417 net::ERR_ABORTED 404 (Not Found) http://localhost:8888/static/notebook/js/notebook/js/main.js:230 Warning: Widgets are not available. Please install widgetsnbextension or ipywidgets 4.0 … [W 20:56:54.769 LabApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20180803205417 (127.0.0.1) 3.96ms referer=http://localhost:8888/notebooks/src/github.com/jupyter-widgets/pythreejs/examples/Animation.ipynb … utils.js:37 Loading extension: jupyter-js-widgets/extension Error: debugger:///VM910:28 Uncaught (in promise) SyntaxError: Unexpected string at new Function () at l (ndarray.js:251) at e.exports (ndarray.js:337) at Object.i [as JSONToArray] (ndarray.js:23) at Object.i [as deserialize] (union.js:16) at Function.WidgetModel._deserialize_state (widget.js:504) at WidgetManager. (manager-base.js:279) at step (manager-base.js:42) at Object.next (manager-base.js:23) at fulfilled (manager-base.js:14) (repeated many times)

======= JupyterLab 0.33.6 ======= (I've added spaces around ~)

main.7c81287d92ea919043dd.js:1 TypeError: Cannot read property 'fasta' of undefined at Object.mdei (vendors ~ main.d8daaad1b50838b3e60f.js:780) at h (main.7c81287d92ea919043dd.js:1) at a (main.7c81287d92ea919043dd.js:1) a @ main.7c81287d92ea919043dd.js:1 vendors ~ main.d8daaad1b50838b3e60f.js:108 Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead. Error at O (http://localhost:8888/lab/static/vendors ~ main.d8daaad1b50838b3e60f.js:108:3958) at Function.E.extend (http://localhost:8888/lab/static/vendors ~ main.d8daaad1b50838b3e60f.js:108:2960) at Object.OTXi (http://localhost:8888/lab/static/vendors~main.d8daaad1b50838b3e60f.js:472:40093) at h (http://localhost:8888/lab/static/main.7c81287d92ea919043dd.js:1:928) at Object.O3wJ (http://localhost:8888/lab/static/vendors~main.d8daaad1b50838b3e60f.js:458:1084) at h (http://localhost:8888/lab/static/main.7c81287d92ea919043dd.js:1:928) at Object.xtrE (http://localhost:8888/lab/static/vendors~main.d8daaad1b50838b3e60f.js:913:32234) at h (http://localhost:8888/lab/static/main.7c81287d92ea919043dd.js:1:928) at Object.12aA (http://localhost:8888/lab/static/vendors~main.d8daaad1b50838b3e60f.js:21:26573) at h (http://localhost:8888/lab/static/main.7c81287d92ea919043dd.js:1:928) O @ vendors ~ main.d8daaad1b50838b3e60f.js:108 main.7c81287d92ea919043dd.js:1 Error: Cannot find module '@jupyterlab/celltags/' at s (main.7c81287d92ea919043dd.js:1) at a (main.7c81287d92ea919043dd.js:1) a @ main.7c81287d92ea919043dd.js:1 main.7c81287d92ea919043dd.js:1 TypeError: Cannot read property 'registerHelper' of undefined at Object.sjUu (vendors ~ main.d8daaad1b50838b3e60f.js:869) at h (main.7c81287d92ea919043dd.js:1) at Object.Dcwf (vendors ~ main.d8daaad1b50838b3e60f.js:304) at h (main.7c81287d92ea919043dd.js:1) at a (main.7c81287d92ea919043dd.js:1) a @ main.7c81287d92ea919043dd.js:1 main.7c81287d92ea919043dd.js:1 Error: Cannot find module 'jupyter-webrtc/lib/labplugin' at s (main.7c81287d92ea919043dd.js:1) at a (main.7c81287d92ea919043dd.js:1) a @ main.7c81287d92ea919043dd.js:1 main.7c81287d92ea919043dd.js:1 Error: Cannot find module 'jupyterlab-volume/' at s (main.7c81287d92ea919043dd.js:1) at a (main.7c81287d92ea919043dd.js:1) a @ main.7c81287d92ea919043dd.js:1

# Running examples/Animation.ipynb … webpack:///./node_modules/@jupyter-widgets/base/lib/utils.js:119 Error: Could not create a model. at r (utils.js:119) … webpack:///./node_modules/@jupyterlab/services/lib/kernel/default.js:928 Exception opening new comm … default.js:129 RangeError: Maximum call stack size exceeded at Function.get [Symbol.species] () at Promise.then () at Object.h [as resolvePromisesDict] (utils.js:101) at h (widget.js:48) at widget.js:46 at Array.forEach () at h (widget.js:45) at widget.js:46 (repeated many times)

I'm at the dead end, as bqplot and plotlywidget examples run with nearly unnoticeable issues (if one doesn't look at the Chrome console), jupyterlab-manager is working (for example, I can search for new extensions). Please, help.

mprogram commented 6 years ago

I've just re-run the Animation example under the classic notebook, which did not, and got the following trace in the Chrome console, if it's related:

Failed to load extension: ["nbextensions/widgetsnbextension"] Error: Script error for "nbextensions/widgetsnbextension" http://requirejs.org/docs/errors.html#scripterror at makeError (require.js?v=6da8be3…e721e76c6d4afce:165) at HTMLScriptElement.onScriptError (require.js?v=6da8be3…721e76c6d4afce:1732)

GET http://localhost:8888/nbextensions/widgets/notebook/js/extension.js?v=20180803090930 net::ERR_ABORTED 404 (Not Found)

~The plotly example 'ScatterGL Example' (see typo correction in plotly/plotly.py/issues/1090) rendered properly in JLab - does not do so in the classic notebook, also with the above message, and spews a lot of 404 errors, GET'ting files which simply are not there (not in the notebook directory);~ EDITS: still fails from the first run; 'behaves' well when re-run for the second time ~bloomberg/bqplot/examples/Advanced%20Plotting/Animations.ipynb misbehaves too.~ EDITS: now 'behaves' well

Does it provide any clues what might be the cause of all of it? I can confirm that ipywidets 7.3.2 were/are installed from the released python wheel. I have run all above also in incognito mode to exclude cache issues.

mprogram commented 6 years ago

See Jupyter-contrib/jupyter_nbextensions_configurator/issues/75 for a separate issue, possibly pre-related to jupyter-widgets/ipywidgets/pull/2150/files

jasongrout commented 6 years ago

Some thoughts:

  1. In your original error message, default.js:129 Error: Object 'jupyter.widget' not found in registry indicates that the @jupyter-widgets/jupyterlab-manager lab extension is not installed or active for some reason, since that is what registers the comm target it's not finding.

  2. 404 GET /nbextensions/widgetsnbextension.js indicates that whatever is requesting this is very old code (several years old, probably). We haven't used the nbextensions/widgetsnbextension.js file in a long time. On top of that, the error message "Warning: Widgets are not available. Please install widgetsnbextension or ipywidgets 4.0" indicates this is old code. I do remember seeing something vaguely like this in https://github.com/jupyter-widgets/ipywidgets/issues/1702.

I would try cleaning out all jupyter --path config and data directories (user, sys-prefix, system, etc.) of all mentions of widgets. Then I would install in a new environment. That I think would reset to a known good state.

mprogram commented 6 years ago

ok, thanks you both for your valuable suggestions; here is a follow up:

  1. I switched to the Firefox's cleaner Web Console.
  2. There was initial ~/.jupyter/lab/extensions where I had run the lab with $JUPYTERLAB_HOME set, abandoning it in favor of /usr/share/jupyter/lab/… with clean environment to investigate the issue opener. The question remains if JupyterLab presently does fully respect the --app-dir directory (cf. update at the bottom: it seems it does…).
  3. Indeed, there was ~/.jupyter/nbconfig/notebook.json with "widgetsnbextension": true – now deleted – as opposed to /etc/jupyter/nbconfig/notebook.d/widgetsnbextenion.json with "jupyter-js-widgets/extension": true; I went further and disabled there "varInspector/main" (actually deleted the notebook.json file altogether). I've also disabled jupyter_latex_envs, which was a bit painful as it is a dependecy for jupyter_contrib_nbextensions, but it doesn't matter for now as I'm cleaning the way to have prettier logs. As a side note there is no consolidated registry for the 'known to work' extensions.

First sign after all above was that the still installed jupyterlab-manager suddenly received the false status in Advanced Settings Editor (maintaining the enabled status in jupyter labextension list), which I set to "enabled": true thereafter.


Let's start JLab, so, in the Web Console (only W's and E's are shown):

TypeError: "n.indexOf is not a function"

onLintMessage http://localhost:8888/lab/static/vendors~main.4e858f08547f7556fe16.js:632:713668 v http://localhost:8888/lab/static/vendors~main.4e858f08547f7556fe16.js:856:27859 u http://localhost:8888/lab/static/vendors~main.4e858f08547f7556fe16.js:856:27537 emit http://localhost:8888/lab/static/vendors~main.4e858f08547f7556fe16.js:856:25619 onmessage http://localhost:8888/lab/static/vendors~main.4e858f08547f7556fe16.js:878:11617

qUp9/</</t.exceptionHandler webpack:///node_modules/@phosphor/signalling/lib/index.js:220 v webpack:///node_modules/@phosphor/signalling/lib/index.js:478 u webpack:///node_modules/@phosphor/signalling/lib/index.js:433 qUp9/</i</e.prototype.emit webpack:///node_modules/@phosphor/signalling/lib/index.js:106 _initializeSocket/</t.onmessage webpack:///node_modules/@jupyterlab/services/lib/terminal/default.js:178



…(and no offending messages in the classic notebook). 
___
Well, let's run the `bqplot` and `plotly` above examples – work mostly well (see my edits). 
___
Let's run the trusted opener [jupyter-widgets/pythreejs/examples/Animation.ipynb](https://github.com/jupyter-widgets/pythreejs/examples/Animation.ipynb) – not truly fails after _input 9_, but nothing to see in the resized output and it shows the concluding warning: 

`TV(283422): unfreeze Renderable.js:437`
`TV(283422): ThreeView.acquiring... Renderable.js:437`
`RendererPool.acquiring... RendererPool.js:99`
`THREE.WebGLRenderer 90 three.js:167:207`
`RendererPool.acquire(id=0) RendererPool.js:144`
`TV(283422): ThreeView.acquireRenderer(0) Renderable.js:437`
`TV(283422): Enable controls Renderable.js:437`
`TV(283422): renderScene Renderable.js:437`
`THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0 three.js:311:211`

_**Notice `r90` support here, and compare it with the run under JLab at the bottom of this comment**_
___
Now run the same in JLab:

after _input 7_:
`Error: "Could not create a model."  – @jupyter-widgets/base/lib/utils.js:119`
`Exception opening new comm – @jupyterlab/services/lib/kernel/default.js:928`
`.`
`_handleCommOpen/< @jupyterlab/services/lib/kernel/default.js:928`
`s @jupyterlab/services/lib/kernel/default.js:7:40`
`o handsontable/dist/handsontable.js:15932`
`O/< handsontable/dist/handsontable.js:15945`
`u handsontable/dist/handsontable.js:28640`
`.`
`InternalError: "too much recursion" – @jupyterlab/services/lib/kernel/default.js:129`

:**_I guess this is a real bug_**:

**UPDATE**: Under Chrome v70.0.3510.0 it fails in _input 3_, but not under Firefox Quantum v61.0.1 (64-bit)!, (double, cross-checked!) with:
default.js:928 Exception opening new comm
…
default.js:129 Error: Object 'jupyter.widget' not found in registry
    at M.Promise (default.js:1476)
    at new Promise (<anonymous>)
    at Object.M [as loadObject] (default.js:1455)
    at y.<anonymous> (default.js:921)
    at Generator.next (<anonymous>)
    at default.js:9
    at new Promise (<anonymous>)
    at YC29.n (default.js:5)
    at y._handleCommOpen (default.js:913)
    at y.<anonymous> (default.js:1020)
    at Generator.next (<anonymous>)
    at default.js:9
    at new Promise (<anonymous>)
    at YC29.n (default.js:5)
    at y._handleMessage (default.js:977)
    at _msgChain._msgChain.then (default.js:124)

_…but then still fails under Firefox, on input 7 as described above._
___
Upon running other `pythreejs` examples I'm seeing the warning (might be helpful): 
`THREE.WebGLShader: gl.getShaderInfoLog() vertex 0:2(12): warning: extension 'GL_ARB_gpu_shader5' unsupported in vertex shader`

**UPDATE**: I've just spotted this [bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1319801) on Bugzilla, marked as "resolved", but users do not agree (scroll to the bottom).

In [jupyter-widgets/pythreejs/examples/Geometries.ipynb](https://github.com/jupyter-widgets/pythreejs/examples/Geometries.ipynb) it produces (as it did earlier) the actual outputs of differently shaped figures
(on Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller)

_**What is weird here, is that it shows `THREE.WebGLRenderer 95dev` under JLab but `90` under the classic notebook (checked simultaneously with restarting the kernels!) whereas I have installed `pythreejs` and `jupyter-threejs` with `r90` support (double, cross-checked, file stamps are from 7 Jun), and I'm running **both** in incognito mode**._

Two interim questions on the road to actually get animation functionality: `pythreejs 1.1.0` is based on `three.js r90`, what are / where one can find the corresponding hardware requirements and known limitations? What does mean the output received from JLab from _input 7_? Why `r90` may show `r95dev` under JLab (but not in the classic notebook) in the Web Console, does it fetch it online? Thank you for looking into this. 

_**UPDATE on my last question about r95dev**: might be related to the [jupyterlab-build-process](https://github.com/jupyterlab/jupyterlab/blob/master/docs/source/user/extensions.rst#jupyterlab-build-process)_
mprogram commented 6 years ago

See jupyterlab/jupyterlab/issues/5070 for the current jupyter labextension list output.

mprogram commented 6 years ago

On top of that, the error message "Warning: Widgets are not available. Please install widgetsnbextension or ipywidgets 4.0" indicates this is old code. I do remember seeing something vaguely like this in jupyter-widgets/ipywidgets#1702.

@jasongrout: BTW, the above message was/is being generated by the legit current notebook code, lines:

notebook/static/notebook/js/main.js:230:                console.warn('Widgets are not available.  Please install widgetsnbextension or ipywidgets 4.0');
notebook/static/notebook/js/main.min.js:50480:                console.warn('Widgets are not available.  Please install widgetsnbextension or ipywidgets 4.0');

(…and then occasionally it doesn't show up on the second run; couldn't get it now after jlab/ipywidgets upgrade)

Perhaps, slow/deferred on HDDs, or, on the contrary, too-speedy asynchronous initialization on SSDs like in that bug described in lightdm?

mprogram commented 6 years ago

UPDATE: I've updated to ipywidgets 7.4.0 and disabled the following extensions to reduce the log noise with no impact on the issue

{
    "disabledExtensions": [
        "@jupyterlab/celltags",
        "@jupyter-widgets/jupyterlab-sidecar",
        "@jupyterlab/git",
        "@jupyterlab/vdom-experimental-extension",
        "jupyterlab_vpython_test",
        "jupyterlab-sos",
        "jupyterlab-volume",
        "jupyter-webrtc"
    ]
}
Techdread commented 6 years ago

Can how to install this plugin into Jupyter Lab be included in the readme as I only managed to do this by reading this issue.

mprogram commented 6 years ago

UPDATE: I've re-run in Chrome the Animation example under the classic notebook, and got the following trace:

VM1259:28 Uncaught (in promise) SyntaxError: Unexpected string
    at new Function (<anonymous>)
    at l (ndarray.js:251)
    at e.exports (ndarray.js:337)
    at Object.i [as JSONToArray] (ndarray.js:23)
    at Object.i [as deserialize] (union.js:16)
    at Function.WidgetModel._deserialize_state (widget.js:504)
    at WidgetManager.<anonymous> (manager-base.js:279)
    at step (manager-base.js:42)
    at Object.next (manager-base.js:23)
    at fulfilled (manager-base.js:14)

Debugging link opens the following snippet (line 28 starts with proto.transpose):

(function anonymous(CTOR_LIST,ORDER
) {
'use strict'
function View1dfloat32(a,b0,c0,d){this.data=a
this.shape=[b0]
this.stride=[c0]
this.offset=d|0}
var proto=View1dfloat32.prototype
proto.dtype='float32'
proto.dimension=1
Object.defineProperty(proto,'size',{get:function View1dfloat32_size(){return this.shape[0]
}})
proto.order=[0]
proto.set=function View1dfloat32_set(i0,v){
return this.data[this.offset+this.stride[0]*i0]=v}
proto.get=function View1dfloat32_get(i0){
return this.data[this.offset+this.stride[0]*i0]}
proto.index=function View1dfloat32_index(
i0
){return this.offset+this.stride[0]*i0}
proto.hi=function View1dfloat32_hi(i0){return new View1dfloat32(this.data,(typeof i0!=='number'||i0<0)?this.shape[0]:i0|0,this.stride[0],this.offset)}
proto.lo=function View1dfloat32_lo(i0){var b=this.offset,d=0,a0=this.shape[0],c0=this.stride[0]
if(typeof i0==='number'&&i0>=0){d=i0|0;b+=c0*d;a0-=d}
return new View1dfloat32(this.data,a0,c0,b)}
proto.step=function View1dfloat32_step(i0){var a0=this.shape[0],b0=this.stride[0],c=this.offset,d=0,ceil=Math.ceil
if(typeof i0==='number'){d=i0|0;if(d<0){c+=b0*(a0-1);a0=ceil(-a0/d)}else{a0=ceil(a0/d)}b0*=d}
return new View1dfloat32(this.data,a0,b0,c)}
proto.transpose=function View1dfloat32_transpose(['i0']){i0=(i0===undefined?0:i0|0)
var a=this.shape,b=this.stride;return new View1dfloat32(this.data,a[i0],b[i0],this.offset)}
proto.pick=function View1dfloat32_pick(['i0']){var a=[],b=[],c=this.offset
if(typeof i0==='number'&&i0>=0){c=(c+this.stride[0]*i0)|0}else{a.push(this.shape[0]);b.push(this.stride[0])}
var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}
return function construct_View1dfloat32(data,shape,stride,offset){return new View1dfloat32(data,shape[0],stride[0],offset)}
})
mprogram commented 6 years ago

No longer the issue after various upgrades, closing. For future reference, I would recommend a "zero warnings" policy and also asking/posting JLab's build logs, paying special attention to the emitted warnings, which are not at all harmless.

Other particular issues may arise because of JLab's behavior not strictly aligned with the related jupyterlab-build-process , namely

"Note that building will always use the latest JavaScript packages that meet the dependency requirements of JupyterLab itself and any installed extensions. If you wish to run JupyterLab with the set of pinned requirements that was shipped with the Python package, you can launch as jupyter lab --core-mode."

I have the threejs dependency designated as ^0.90.0, yet, the JLab build behaves a lot like ~0.90.0.

vidartf commented 6 years ago

@mprogram Note that semver with ^0.X.Y behaves differently than ^X.Y.Z with X>0. See https://docs.npmjs.com/misc/semver#caret-ranges-123-025-004

mprogram commented 6 years ago

Ah, thanks for your reply, Vidar!

vidartf commented 6 years ago

Sure! Happy you got everything sorted out in the end 👍