Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matplotlib Qt backend does not work on Wayland #158806

Closed
jbuchermn opened this issue Feb 9, 2022 · 11 comments
Closed

Matplotlib Qt backend does not work on Wayland #158806

jbuchermn opened this issue Feb 9, 2022 · 11 comments
Labels
0.kind: bug Something is broken 2.status: duplicate This is a duplicate of another issue or PR 6.topic: qt/kde

Comments

@jbuchermn
Copy link

Describe the bug

Cannot start the Qt backend on matplotlib on Wayland. The following errors are thrown:

qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""

Probably qtwayland (and also something like qtxcb?) is missing as a dependency. See https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/video/vlc/default.nix which had the same issue.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install matplotlib using matplotlib = super.matplotlib.override { enableQt = true; };
  2. Try simple plot script python3 -c "import matplotlib.pyplot as plt; plt.figure()"

Expected behavior

Plotting works on Qt natively on Wayland

Screenshots

Additional context

Notify maintainers

@lovek323 @veprbl

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.95, NixOS, 22.05 (Quokka)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.6.0`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@jbuchermn jbuchermn added the 0.kind: bug Something is broken label Feb 9, 2022
@jbuchermn jbuchermn changed the title Matplotlib Qt Backend does not work on Wayland Matplotlib Qt backend does not work on Wayland Feb 9, 2022
@rnhmjoj
Copy link
Contributor

rnhmjoj commented Feb 10, 2022

I think this is just #80147, unrelated to wayland.

@jbuchermn
Copy link
Author

That‘s a 2 year old issue - are you sure?

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Feb 10, 2022

It has never been fixed, so yes, sadly.

@veprbl
Copy link
Member

veprbl commented Feb 10, 2022

Is this a bug with pyqt5 though? I suppose a reasonable solution would be to patch it to set the variables similarly to how it's done in the bash wrapper.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Feb 10, 2022

No, the problem is there is currently no way to propagate variables from python packages to the interpreter wrapper.

A quick solution was #83321, but it was scrapped by @FRidh who later proposed #102949, now stalled.

Basically everything is waiting for a unified makeWrapper interface, which is never coming for some reason.

@veprbl
Copy link
Member

veprbl commented Feb 10, 2022

I was thinking about implementing https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh in python and putting it in the pyqt5 module. This would act only for use of pyqt5 as a library in a development environment. The applications would need to be wrapped to "freeze" the paths.

@jbuchermn
Copy link
Author

Okay, thanks for the additional infos. I understand it's not wayland related but more general.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Feb 11, 2022

If you want to use the Qt backend, for now, the only way is this workaround: #80147 (comment)

@veprbl
Copy link
Member

veprbl commented Feb 11, 2022

Could we plug the QT_PLUGIN_PATH setting into qtbase as a setup-hook?

@jbuchermn
Copy link
Author

If you want to use the Qt backend, for now, the only way is this workaround: #80147 (comment)

Thanks a lot, this works and I realize that this issue is a duplicate of #80147. For anyone stumbling upon this: Additionally to the comment one needs to add qt5.qtwayland as a buildInput.

Do you want me to close this issue, or do you want to continue the conversation here?

@FRidh
Copy link
Member

FRidh commented Mar 29, 2022

Let's use #80147.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 2.status: duplicate This is a duplicate of another issue or PR 6.topic: qt/kde
Projects
None yet
Development

No branches or pull requests

4 participants