Open3D icon indicating copy to clipboard operation
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.

Open Hi-Daniel opened this issue 1 year ago • 1 comments

Checklist

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

Hi-Daniel avatar Jul 15 '24 23:07 Hi-Daniel

Facing same issue

SemaanAnthony avatar Jul 31 '24 07:07 SemaanAnthony

@Hi-Daniel Were you ever able to resolve this issue?

christiandur4nt avatar Nov 08 '24 03:11 christiandur4nt

@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 avatar Nov 08 '24 04:11 Hi-Daniel

@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.

christiandur4nt avatar Nov 08 '24 15:11 christiandur4nt

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.

chenx-dust avatar Jan 27 '25 13:01 chenx-dust

I run this on fedora silverblue and I can confirm that the export XDG_SESSION_TYPE=x11 workaround works.

cosama avatar Mar 11 '25 19:03 cosama

getting same error if u can resolve it pls share

Pratikw369 avatar Mar 17 '25 19:03 Pratikw369

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?

alserpe avatar Mar 21 '25 11:03 alserpe

@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.

Combining these two solutions, my problem was successfully solved

ZhangYazhengCN avatar Mar 24 '25 14:03 ZhangYazhengCN

@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.

Combining these two solutions, my problem was successfully solved

Yes that solved my problem too.

ghliu521 avatar Jul 28 '25 15:07 ghliu521

@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.

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.

w-poh avatar Aug 19 '25 12:08 w-poh

Foor anyone else facing these sort of issues, you can check the build manual I put in place Open3D on WSL + CUDA

Spinkoo avatar Sep 11 '25 17:09 Spinkoo

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.

AndreiOsipov avatar Sep 22 '25 11:09 AndreiOsipov

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

nicogorlo avatar Oct 16 '25 00:10 nicogorlo

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.

radugrecu97 avatar Nov 02 '25 15:11 radugrecu97