Skip to content

[ENH]: WSL support #32381

Description

@FabriceSalvaire

Problem

Actually it is not user-friendly to run Matplotlib on WSL.

Moreover, this answer python - Show matplotlib plots (and other GUI) in Ubuntu (WSL1 & WSL2) - Stack Overflow is outdated.

Since WSL2 implements the Wayland protocol and the OpenGL API, Matplolib should detect it is running on WSL and select automatically the right backend or raises an informative error message.

To detect WSL, we can rely on:

  • uname kernel
  • or the presence of /etc/wsl-distribution.conf

For the backend, we can use:

  • Qt Agg with PyQt5 and set the env QT_QPA_PLATFORM=wayland (PySide2 seems to crash)
  • to be completed Qt6 GTK Vulkan...

QT_QPA_PLATFORM is mandatory since Qt is probably not able to detect WSL and select the right backend.

RESUME for USERS: YOU DON'T NEED X11 ! It should work out of the box !

Proposed solution

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions