Open3D
Open3D copied to clipboard
Jupyter Lab Python Kernel crashes when I try to close the visualization window
### Checklist
- [X] I have searched for similar issues.
- [X] For Python issues, I have tested with the latest development wheel.
- [X] I have checked the release documentation and the latest documentation (for
masterbranch).
Describe the issue
In Jupyter lab, I try to render an STL file using the open3d.visualization.draw_geometries() method. When I run the program, I get an error: "Cocoa: Failed to find service port for display", however a window pops up as expected, showing my successfully rendered geometry. The name of the process underwriting this window is "Python" (according to the Activity Monitor). Looking good so far.
The problem arises when I try to close the window containing the rendering. The window doesn't close; instead the process stops responding and I'm hit with the rainbow spinning wheel, causing me to force quit the application from the Activity Monitor. This happens every time I run the program on Jupyter lab.
However, it's worth noting that this problem is absent when I run the same lines of code with Visual Studio Code, which I'm taking to mean there's something funky with Open3D's integration with Jupyter. In VSCode, I still get the "Cocoa: Failed to find service port for display" error, but I am able to close the render window no problem.
Steps to reproduce the bug
import numpy as np
import open3d as o3d
temp = o3d.io.read_triangle_mesh('test_sphere.stl')
print(temp)
o3d.visualization.draw_geometries([temp])
Error message
[Open3D WARNING] GLFW Error: Cocoa: Failed to find service port for display
Expected behavior
- Render window closes
Open3D, Python and System information
- Operating system: MacOS 13.1 (22C65)
- Python version: Python 3.9.1
- Open3D version: 0.16.1
- Jupyter lab version: 3.2.2
- System architecture: apple-silicon
- Is this a remote workstation?: no
- How did you install Open3D?: pip
- Compiler version (if built from source): N/A
Additional information
Additionally, I tried to run one of the jupyter examples (just to see if it's my code or something like an installation issue). I ran the following: `# import open3d as o3d from open3d.web_visualizer import draw
cube_red = o3d.geometry.TriangleMesh.create_box(1, 2, 4) cube_red.compute_vertex_normals() cube_red.paint_uniform_color((1.0, 0.0, 0.0)) draw(cube_red)
cube_blue = o3d.geometry.TriangleMesh.create_box(1, 2, 4) cube_blue.compute_vertex_normals() cube_blue.paint_uniform_color((0.0, 0.0, 1.0)) draw(cube_blue)`
And got the error:
`---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/var/folders/5f/1dm3w4px4b3cvb1gz1gfkx5w0000gn/T/ipykernel_12177/3961190166.py in
~/Library/Python/3.9/lib/python/site-packages/open3d/web_visualizer.py in
RuntimeError: Open3D WebVisualizer Jupyter extension is not available. To use WebVisualizer, build Open3D with -DBUILD_JUPYTER_EXTENSION=ON.
2023-02-22 21:13:45.313 Python[12177:377355] WARNING: nextEventMatchingMask should only be called from the Main Thread! This will throw an exception in the future.
2023-02-22 21:13:45.313 Python[12177:377355] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], NSUndoManager.m:1117
2023-02-22 21:13:45.323 Python[12177:377355] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], NSUndoManager.m:1117
2023-02-22 21:13:45.324 Python[12177:377355] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], NSUndoManager.m:1117
2023-02-22 21:13:45.325 Python[12177:377355] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], NSUndoManager.m:1117
2023-02-22 21:13:45.326 Python[12177:377355] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], NSUndoManager.m:1117
2023-02-22 21:13:45.327 Python[12177:377355] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], NSUndoManager.m:1117`

The error actually continues indefinitely and causes Jupyter lab to become unresponsive, forcing me to close it and kill the kernel from terminal. An image of the error output is also attached. I suspect these two issues are connected.
Hi, also running into this issue. Any updates? Thanks!
- Python version: Python 3.8.18, 3.11.7
- Open3D version: 0.18.0
- System architecture: apple-silicon
- Is this a remote workstation?: no
- How did you install Open3D?: pip
Same issue. When I use jupyter-notebook, run this code-"o3d.visualization.draw_geometries([mesh])", the window will open normally, but when I press 'Q' or close the window, the window will be freeze, I must force quit.
Apple M2 Python: 3.10.14 open3d: 0.18.0 jupyter: 1.0.0