Open3D
Open3D copied to clipboard
Open3D on WSL2 unable to visualize. Error: GLFW Error: Wayland: The platform does not support setting the window position, Failed to initialize GLEW., [DrawGeometries] Failed creating OpenGL 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
mainbranch).
Describe the issue
I am unable to run visualization with open3D running on WSL2.
I have looked at many similar issues however none of the solutions seem to work.
Before I was getting issues similar to this one. But after creating the symlinks as described in that issue, and after downloading Open3D using conda-forge instead of pip, I was able to curb the "LibGl Error: ..." problems and now I just get the warnings above, but no output.
more info:
- miniconda, conda version 24.4.0.
- I installed open3D with
conda install -c conda-forge open3D - Ubuntu 22.04.4 LTS
my output from glxinfo -B is the following:
glxinfo -B
name of display: :0
display: :0 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Microsoft Corporation (0xffffffff)
Device: D3D12 (Intel(R) UHD Graphics) (0xffffffff)
Version: 23.2.1
Accelerated: yes
Video memory: 16381MB
Unified memory: yes
Preferred profile: core (0x1)
Max core profile version: 4.1
Max compat profile version: 4.1
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.0
OpenGL vendor string: Microsoft Corporation
OpenGL renderer string: D3D12 (Intel(R) UHD Graphics)
OpenGL core profile version string: 4.1 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2
OpenGL core profile shading language version string: 4.10
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.1 (Compatibility Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2
OpenGL shading language version string: 4.10
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 23.2.1-1ubuntu3.1~22.04.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
Steps to reproduce the bug
import open3d as o3d
# Create a point cloud (you can replace this with your actual data)
points = [[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]]
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(points)
# Visualize the point cloud
o3d.visualization.draw_geometries([pcd])
Error message
the error that I get:
[Open3D WARNING] GLFW Error: Wayland: The platform does not support setting the window position
[Open3D WARNING] Failed to initialize GLEW.
[Open3D WARNING] [DrawGeometries] Failed creating OpenGL window.
Expected behavior
I expected to be able to visualize geometries.
Open3D, Python and System information
- Operating system: Ubuntu 22.04.4 LTS
- Python version: Python 3.12.4 (also tried python 3.11.9)
- Open3D version: 0.18.0+a38ec05
- System architecture: x86
- Is this a remote workstation?: yes? (WSL2)
- How did you install Open3D?: conda (also tried pip)
- Compiler version (if built from source): N/A
Additional information
No response
Facing same issue
@Hi-Daniel Were you ever able to resolve this issue?
@christiandur4nt No, I actually decided to give up on WSL... The weirdest part to me is that I am able to run the command line open3d tool to view 3D object files, so at least I know that it is not a limitation of using wsl.
@Hi-Daniel Thanks for the reply. I was able to fix it using a fix from a separate but related issue #5126. Performing conda install -c conda-forge libstdcxx-ng fixed it for me.
I'm glad to announce a workaround, just adding an environment variable:
export XDG_SESSION_TYPE=x11
This will make GLFX think it's in an X11 session, then it will choose X11 as its backend instead of Wayland.
I run this on fedora silverblue and I can confirm that the export XDG_SESSION_TYPE=x11 workaround works.
getting same error if u can resolve it pls share
I am having the same issue in Ubuntu with Wayland. When I change to X11 if works well but I am missing functionalities in that way, It is not the solution. When I run in a python script "o3d.visualization.draw_geometries([pcd])" I get the error:
[Open3D WARNING] GLFW Error: Wayland: The platform does not support setting the window position [Open3D WARNING] Failed to initialize GLEW. [Open3D WARNING] [DrawGeometries] Failed creating OpenGL window.
I also tried the export solutions above but nothing worked. Any new solution?
@Hi-Daniel Thanks for the reply. I was able to fix it using a fix from a separate but related issue #5126. Performing
conda install -c conda-forge libstdcxx-ngfixed it for me.
I'm glad to announce a workaround, just adding an environment variable:
export XDG_SESSION_TYPE=x11 This will make GLFX think it's in an X11 session, then it will choose X11 as its backend instead of Wayland.
Combining these two solutions, my problem was successfully solved
@Hi-Daniel Thanks for the reply. I was able to fix it using a fix from a separate but related issue #5126. Performing
conda install -c conda-forge libstdcxx-ngfixed it for me.I'm glad to announce a workaround, just adding an environment variable: export XDG_SESSION_TYPE=x11 This will make GLFX think it's in an X11 session, then it will choose X11 as its backend instead of Wayland.
Combining these two solutions, my problem was successfully solved
Yes that solved my problem too.
@Hi-Daniel Thanks for the reply. I was able to fix it using a fix from a separate but related issue #5126. Performing
conda install -c conda-forge libstdcxx-ngfixed it for me.
Thank you!! It solved this error for me:
[Open3D WARNING] GLFW Error: GLX: No GLXFBConfigs returned [Open3D WARNING] GLFW Error: GLX: Failed to find a suitable GLXFBConfig [Open3D WARNING] Failed to create window [Open3D WARNING] [DrawGeometries] Failed creating OpenGL window.
while trying to get the easiest example:
import open3d as o3d
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector([[0,0,0],[1,0,0],[0,1,0]])
o3d.visualization.draw_geometries([pcd])
System: Ubuntu 24.04
glxinfo | grep "OpenGL renderer" echoes: OpenGL renderer string: Mesa Intel(R) Iris(R) Xe Graphics (RPL-P)
Using this code in a Jupyter Notebook with Python 3.12.
Foor anyone else facing these sort of issues, you can check the build manual I put in place Open3D on WSL + CUDA
I'm glad to announce a workaround, just adding an environment variable:
export XDG_SESSION_TYPE=x11 This will make GLFX think it's in an X11 session, then it will choose X11 as its backend instead of Wayland.
Its works for me, thanks! And i havent X11 server on my winodws host machine or something like that, so its works like matplotlib without sometimes difficults.
If you prefer not to use conda-forge, the following should work aswell (WSL2 with Ubuntu 24.04):
sudo apt update && sudo apt install gcc-14 g++-14 libstdc++6
export XDG_SESSION_TYPE=x11
I'm glad to announce a workaround, just adding an environment variable:
export XDG_SESSION_TYPE=x11
This will make GLFX think it's in an X11 session, then it will choose X11 as its backend instead of Wayland.
If you use jupyter notebook like me run:
import os
os.environ["XDG_SESSION_TYPE"] = "x11"
as the notebook runs separate from the terminal shells.