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

Error when modifying the example to use pyqt6 instead of pyqt5 #239

Open
mkondratyev85 opened this issue Oct 15, 2022 · 5 comments
Open

Comments

@mkondratyev85
Copy link

I'm trying to use pyvistaqt with pyqt6 but I'm having some problems.

For example, if I take a script from https://qtdocs.pyvista.org/usage.html from the section "Example PyQt5 PyVista QtInteractor"
and change 4th line of the script from

os.environ["QT_API"] = "pyqt5"

to

os.environ["QT_API"] = "pyqt6"

I get the following error:

Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  12 (X_ConfigureWindow)
  Resource id in failed request:  0x2
  Serial number of failed request:  7
  Current serial number in output stream:  8

Nothing changes if I directly import pyqt6 by commenting out the usage of qtpy:

#import os
#os.environ["QT_API"] = "pyqt5"

#from qtpy import QtWidgets

from PyQt6 import QtWidgets

My version of pyvista is 0.9.0

@adam-grant-hendry
Copy link
Contributor

adam-grant-hendry commented Oct 30, 2022

@mkondratyev85 I would recommend a couple quick checks to get you started fixing the issue:

  1. If able, look to see if you can update your graphics driver. e.g. I have seen this error occur with older NVIDIA GPU drivers
  2. If able, update your version of pyvista. The current version is 0.36.1, so there are likely to have been several fixes in place since then (e.g. I believe PySide2 support was added to pyvistaqt after 0.9.0. Similar support may have been added for PyQt6)
  3. Specifically with PySide6 version 6.4.0 (i.e. the latest), there is a known bug (see qtpy #377) that is causing many downstream libraries to fail. The current solution is to use PySide6 < 6.4.0 (i.e. 6.3.1 or older) until the issue is resolved. Something similar may be occurring with the latest versions of PyQt6.
  4. Check the version of qtpy you are using, and if able, update to the latest version.

@adam-grant-hendry
Copy link
Contributor

adam-grant-hendry commented Oct 30, 2022

@mkondratyev85 Also, if you can, would you please provide us with some system information so we can help you debug the issue further? e.g. If you run:

import pyvista as pv
pv.Report()

in a terminal and copy and paste the output here, that will help us.

Second, can you confirm for us that the script you tried to run was the [`Example PyQt5 PyVista QtInteractor`](https://qtdocs.pyvista.org/usage.html#example-pyqt5-pyvista-qtinteractor) script?

Update: I see you wrote that in your original post after reading further; my mistake.

Thank you for taking the time to report an issue!

@mkondratyev85
Copy link
Author

@adam-grant-hendry thank you for helping me.

System informations after pv.Report():

                OS : Linux
            CPU(s) : 8
           Machine : x86_64
      Architecture : 64bit
               RAM : 5.7 GiB
       Environment : Python
       File system : ext4
        GPU Vendor : AMD
      GPU Renderer : AMD Radeon Vega 8 Graphics (raven, LLVM 13.0.1, DRM 3.42, 5.15.0-47-generic)
       GPU Version : 4.6 (Core Profile) Mesa 22.0.1

  Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]

           pyvista : 0.36.1
               vtk : 9.2.2
             numpy : 1.21.5
           imageio : 2.22.1
           appdirs : 1.4.4
            scooby : 0.5.12
        matplotlib : 3.5.1
         pyvistaqt : 0.9.0
             PyQt5 : 5.15.6
           IPython : 8.5.0
             scipy : 1.8.0
        jupyterlab : 3.4.8

My version of drivers are updated. And it looks like I'm using the latest versions of pyvista and pyvistaqt.

@mkondratyev85
Copy link
Author

@adam-grant-hendry Can you confirm the issue? Does this example work on your side when you switch to PyQt6?

@mkondratyev85
Copy link
Author

Finally I've figured out what was the source of the problem!

I was using the Wayland display server on my Ubuntu 22.04. After switching from the Wayland to X the code works without a problem now!

I'll keep this issue open as I'm not sure if this an intended behavior or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants