isl-org / isl-org/Open3D

Visualization behavior different between python repl and jupyter notebook

Open
#6,131 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [x] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### Describe the issue

I'm using Open3D on a remote Ubuntu machine with an Nvidia GPU. After trying and failing to use various remote rendering approaches (WebRTC, web_visualizer, x11 forwarding, etc) I've opted to use [Xpra](https://www.xpra.org/) (which is like VNC). After ssh-ing into my remote machine, the following code *works* in an ipython repl, but *not* in a jupyter notebook launched from the same shell:

```python
import open3d as o3d
ply_point_cloud = o3d.data.PLYPointCloud()
pcd = o3d.io.read_point_cloud(ply_point_cloud.path)
o3d.visualization.draw_geometries([pcd])
```

### Steps to reproduce the bug

Setup xpra and start remote jupyter server:
```
ssh -L 8881:localhost:8881 your_machine
xpra start :11
export DISPLAY=:11
jupyter notebook --no-browser --port=8881
```

On your local machine:
```
xpra attach ssh:your_machine:11
```

Navigate to `localhost:8881` and in a new cell execute the following:
```python
import open3d as o3d
ply_point_cloud = o3d.data.PLYPointCloud()
pcd = o3d.io.read_point_cloud(ply_point_cloud.path)
o3d.visualization.draw_geometries([pcd])
```

In your ssh session, start a python/ipython repl and execute the above code to verify that it works in that setting.

### Error message

When run in a jupyter notebook I get the following errors:
```
[Open3D WARNING] GLFW Error: GLX: Failed to create context: GLXBadFBConfig
[Open3D WARNING] Failed to create window
[Open3D WARNING] [DrawGeometries] Failed creating OpenGL window.
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
```

### Expected behavior

The behavior of `o3d.visualization.draw_geometries` should be the same in an ipython repl and a jupyter notebook.

### Open3D, Python and System information

```markdown
- Operating system: Ubuntu 22.04
- Python version: 3.7.4 (default, Aug 13 2019, 20:35:49) [GCC 7.3.0]
- Open3D version: 0.17.0
- System architecture: x86
- Is this a remote workstation?: yes
- How did you install Open3D?: pip
```

### Additional information

Running `!glxinfo` from within the jupyter instance and from the shell I get the following identical output:
```
name of display: :11
display: :11 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
...
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:
...
GLX version: 1.4
GLX extensions:
...
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Mesa/X.org (0xffffffff)
Device: llvmpipe (LLVM 13.0.1, 256 bits) (0xffffffff)
Version: 22.0.5
Accelerated: no
Video memory: 31826MB
Unified memory: no
Preferred profile: core (0x1)
Max core profile version: 4.5
Max compat profile version: 4.5
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
OpenGL vendor string: Mesa/X.org
OpenGL renderer string: llvmpipe (LLVM 13.0.1, 256 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 22.0.5
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
...
OpenGL version string: 4.5 (Compatibility Profile) Mesa 22.0.5
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
...
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 22.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
...
```

I've ensured that `open3d.visualization.webrtc_server.enable_webrtc()` is *not* called but this has no effect.

I've also ensured that the environment variables (namely `$DISPLAY`) are equivalent between the two modes.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.