Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when invoking open3d.web_visualizer.draw in jupyterlab for non blocking visualization. #5605

Closed
3 tasks done
geppi opened this issue Oct 19, 2022 · 6 comments
Closed
3 tasks done
Labels
bug Not a build issue, this is likely a bug.

Comments

@geppi
Copy link
Contributor

geppi commented Oct 19, 2022

Checklist

Describe the issue

Created a Python venv with python3 -m venv --copies --system-site-packages /home/user/open3d.

python --version
Python 3.10.6

Installed jupyterlab, numpy and open3d via pip.

pip list |grep jupyterlab
jupyterlab              3.4.8
jupyterlab-pygments     0.2.2
jupyterlab_server       2.15.2
jupyterlab-widgets      3.0.3

pip list |grep open3d
open3d                  0.16.0

Run the below code in a jupyterlab notebook.

Steps to reproduce the bug

import numpy as np
import open3d as o3d
from open3d.web_visualizer import draw

# Generate some neat n times 3 matrix using a variant of sync function
x = np.linspace(-3, 3, 401)
mesh_x, mesh_y = np.meshgrid(x, x)
z = np.sinc((np.power(mesh_x, 2) + np.power(mesh_y, 2)))
z_norm = (z - z.min()) / (z.max() - z.min())
xyz = np.zeros((np.size(mesh_x), 3))
xyz[:, 0] = np.reshape(mesh_x, -1)
xyz[:, 1] = np.reshape(mesh_y, -1)
xyz[:, 2] = np.reshape(z_norm, -1)
print('xyz')
print(xyz)

pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(xyz)
draw(pcd)

Error message

[Open3D INFO] Window window_0 created.
[Open3D INFO] EGL headless mode enabled.
WARNING: Using soft CircularBuffer (6144 KiB)
FEngine (64 bits) created at 0x7f7159fe6010 (threading is enabled)
[Open3D INFO] ICE servers: {"stun:stun.l.google.com:19302", "turn:user:password@34.69.27.100:3478", "turn:user:password@34.69.27.100:3478?transport=tcp"}
[Open3D INFO] Set WEBRTC_STUN_SERVER environment variable add a customized WebRTC STUN server.
[Open3D INFO] WebRTC Jupyter handshake mode enabled.
[Open Browser Console for more detailed log - Double click to close this message]
Model class 'WebVisualizerModel' from module 'open3d' is loaded but can not be instantiated
TypeError: r._deserialize_state is not a function
at f._make_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.3e1e5adfd821b9b96340.js?v=3e1e5adfd821b9b96340:1:7933)

Expected behavior

Visualization in non blocking mode.

Open3D, Python and System information

- Operating system: Ubuntu 22.04
- Python version: Python 3.10.6
- Open3D version: open3d 0.16.0
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip

Additional information

I get the error in Firefox as well as Brave (Chromium).

@geppi geppi added the bug Not a build issue, this is likely a bug. label Oct 19, 2022
@geppi
Copy link
Contributor Author

geppi commented Oct 20, 2022

It looks like this is caused by an incompatibility of the open3d webvisualizer in jupyter and ipywidgets version 8.
I found the issue Incompatible FigureWidget with ipywidgets 8.0.0rc0 #3686 in the plotly repo. I had the following versions installed.

pip list |grep widget
ipywidgets             8.0.2
jupyterlab-widgets     3.0.3
widgetsnbextension     4.0.3

The workaround suggested in the plotly issue works for me as well, i.e.

pip install ipywidgets==7.7.1 jupyterlab-widgets==1.1.1
.....
Successfully installed ipywidgets-7.7.1 jupyterlab-widgets-1.1.1 widgetsnbextension-3.6.1

@geppi
Copy link
Contributor Author

geppi commented Oct 20, 2022

According to this comment from one of the ipywidgets developers ipywidgets 7.7.2 does provide the updated jupyterlab_widgets dependency on the correct version of jupyterlab_widgets.

@tonmoy-saikia
Copy link

thanks! I was facing the same issue and downgrading helped

@tiaden
Copy link

tiaden commented May 11, 2023

+1 I have the same issue. Hoping for a fix as soon as possible.

@edufschmidt
Copy link

thanks! I was facing the same issue and downgrading helped

same here.

@geppi
Copy link
Contributor Author

geppi commented Aug 31, 2023

I closed the issue because it's fixed by pull request #6239 in master.
However, the current latest release 0.17 still requires the workaround described above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not a build issue, this is likely a bug.
Projects
None yet
Development

No branches or pull requests

4 participants