widgetti / ipyvolume

3d plotting for Python in the Jupyter notebook based on IPython widgets using WebGL
MIT License
1.95k stars 236 forks source link

volshow example from README not working #356

Open rijobro opened 4 years ago

rijobro commented 4 years ago

As per the volume rendering example in the README, I have the following code in a jupyter cell:

import ipyvolume
hdz = ipyvolume.datasets.hdz2000.fetch()
ipyvolume.volshow(hdz.data, lighting=True, width=300, height=300, level=[0.4, 0.6, 0.9])

This gives the error:

TypeError: volshow() got an unexpected keyword argument 'width'

I checked the volshow definition, and effectively width has been removed.

But I also tried with just:

ipyvolume.volshow(hdz.data)

And got the following error:

/opt/conda/lib/python3.8/site-packages/ipyvolume/serialize.py:81: RuntimeWarning: invalid value encountered in true_divide gradient = gradient / np.sqrt(gradient[0]2 + gradient[1]2 + gradient[2]**2)

Any help to get the very first volume rendering example to work?

cklyne commented 2 years ago

same issue for me, when i try to render the provided examples, I either get the following error:

anaconda3/lib/python3.9/site-packages/ipyvolume/serialize.py:92: RuntimeWarning: invalid value encountered in true_divide
  gradient = gradient / np.sqrt(gradient[0] ** 2 + gradient[1] ** 2 + gradient[2] ** 2)

or the notebook cell runs without showing anything.

maartenbreddels commented 2 years ago

note that that warning has nothing to do with the visualization note showing up.

Do you see an error in the js console, and do you use lab or classic notebook?

cklyne commented 2 years ago

I used classic notebooks (not in lab), and I caught 3 errors in the console:


Error: Could not create a view for model id a3b338b9911e477b8d25df4f13b417a6
    y utils.js:119
    promise callback*t.prototype.create_view/t.state_change< manager-base.js:94
    promise callback*t.prototype.create_view manager-base.js:86
    display_model manager-base.js:73
    h extension.js:137
    promise callback*h/</< extension.js:136
    h extension.js:168
    append_mime_type main.min.js:59827
    append_display_data main.min.js:59788
    append_output main.min.js:59469
    handle_output main.min.js:59380
    output main.min.js:61213
    _handle_output_message main.min.js:62975
    i main.min.js:2
    _handle_iopub_message main.min.js:63015
    _finish_ws_message main.min.js:62794
    _msg_queue main.min.js:62785
    promise callback*Kernel.prototype._handle_ws_message main.min.js:62785
    i main.min.js:2
utils.js:119:20

Error: Could not create view
    y utils.js:119
    promise callback*t.prototype.display_model manager-base.js:73
    h extension.js:137
    promise callback*h/</< extension.js:136
    h extension.js:168
    append_mime_type main.min.js:59827
    append_display_data main.min.js:59788
    append_output main.min.js:59469
    handle_output main.min.js:59380
    output main.min.js:61213
    _handle_output_message main.min.js:62975
    i main.min.js:2
    _handle_iopub_message main.min.js:63015
    _finish_ws_message main.min.js:62794
    _msg_queue main.min.js:62785
    promise callback*Kernel.prototype._handle_ws_message main.min.js:62785
    i main.min.js:2
utils.js:119:20

Uncaught (in promise) TypeError: this.renderer is undefined
    render volume.ts:54
    state_change manager-base.js:93
    promise callback*t.prototype.create_view/t.state_change< manager-base.js:87
    promise callback*t.prototype.create_view manager-base.js:86
    display_model manager-base.js:73
    h extension.js:137
    promise callback*h/</< extension.js:136
    h extension.js:168
    append_mime_type main.min.js:59827
    append_display_data main.min.js:59788
    append_output main.min.js:59469
    handle_output main.min.js:59380
    output main.min.js:61213
    _handle_output_message main.min.js:62975
    i main.min.js:2
    _handle_iopub_message main.min.js:63015
    _finish_ws_message main.min.js:62794
    _msg_queue main.min.js:62785
    promise callback*Kernel.prototype._handle_ws_message main.min.js:62785
    i main.min.js:2
2 [volume.ts:54:28]
maartenbreddels commented 2 years ago

hmm, which version of bqplot do you have installed?

cklyne commented 2 years ago

0.12.33

maartenbreddels commented 2 years ago

Ok, strange. Did you do a normal pip install, or did you install things from github?

cklyne commented 2 years ago

conda install, with the command provided at the read me page

maartenbreddels commented 2 years ago

Does normal ipywidgets work?

cklyne commented 2 years ago

yes (i have version 7.6.5 installed)

cklyne commented 2 years ago

I tried running some examples on a remote system I have and I encounter the same issues, I get the gradient error message, and the view doesn't render. I installed the same version of bqplot, im running it on a classic notebook but through a docker container, I installed it through pip, and ipywidgets works. The remote python version is 3.9.5, and my local version is 3.9.7. The remote system produces slightly different console log error messages:

Could not instantiate widget manager-base.js:296:32
    I manager-base.js:296
    a manager-base.js:45
    a manager-base.js:26
    a manager-base.js:18
    (Async: promise callback)
    l manager-base.js:19
    A manager-base.js:20
    A manager-base.js:16
    _make_model manager-base.js:280
    I manager-base.js:269
    a manager-base.js:45
    a manager-base.js:26
    A manager-base.js:20
    A manager-base.js:16
    new_model manager-base.js:255
    handle_comm_open manager-base.js:167
    Underscore 3
    CommManager.prototype.comm_open/this.comms[comm_id]< comm.js:89
    (Async: promise callback)
    comm_open comm.js:85
    i jQuery
    _handle_iopub_message kernel.js:1239
    _finish_ws_message kernel.js:1018
    _msg_queue kernel.js:1009
    (Async: promise callback)
    _handle_ws_message kernel.js:1009
    i jQuery

Error: Could not create a model.
    y utils.js:119
    promise callback*t.prototype.handle_comm_open manager-base.js:172
    Underscore 3
    CommManager.prototype.comm_open/this.comms[comm_id]< comm.js:89
    promise callback*CommManager.prototype.comm_open comm.js:85
    i jQuery
    _handle_iopub_message kernel.js:1239
    _finish_ws_message kernel.js:1018
    _msg_queue kernel.js:1009
    promise callback*Kernel.prototype._handle_ws_message kernel.js:1009
    i jQuery
utils.js:119:20
    y utils.js:119
    (Async: promise callback)
    handle_comm_open manager-base.js:172
    Underscore 3
    CommManager.prototype.comm_open/this.comms[comm_id]< comm.js:89
    (Async: promise callback)
    comm_open comm.js:85
    i jQuery
    _handle_iopub_message kernel.js:1239
    _finish_ws_message kernel.js:1018
    _msg_queue kernel.js:1009
    (Async: promise callback)
    _handle_ws_message kernel.js:1009
    i jQuery

Couldn't process kernel message Error: Script error for "ipyvolume"
http://requirejs.org/docs/errors.html#scripterror
    makeError http://address:8888/static/components/requirejs/require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:168
    onScriptError http://address:8888/static/components/requirejs/require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:1735
kernel.js:1010
    _msg_queue kernel.js:1010
    (Async: promise callback)
    _handle_ws_message kernel.js:1010
    i jQuery

Uncaught (in promise) Error: Script error for "ipyvolume"
http://requirejs.org/docs/errors.html#scripterror
    makeError http://address:8888/static/components/requirejs/require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:168
    onScriptError http://address:8888/static/components/requirejs/require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593:1735
[require.js:168:17](http://address:8888/static/components/requirejs/require.js?v=d37b48bb2137faa0ab98157e240c084dd5b1b5e74911723aa1d1f04c928c2a03dedf922d049e4815f7e5a369faa2e6b6a1000aae958b7953b5cc60411154f593)