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

Getting RuntimeWarning: Selected binding "pyside6" could not be found, using "pyqt5" what to do? #395

Open
jain-brain opened this issue Jan 2, 2023 · 4 comments

Comments

@jain-brain
Copy link

I am receiving the following error. I have searched the internet everywhere for the solution. Can you please tell me how to resolve this? Is this due to incompatibility of versions of the library?

/lib/python3.9/site-packages/qtpy/__init__.py:267: RuntimeWarning: Selected binding "pyside6" could not be found, using "pyqt5" warnings.warn('Selected binding "{}" could not be found, '

@CAM-Gerlach
Copy link
Member

From the minimal information provided above, this itself is just a warning, rather than an error, indicating that QtPy could not find an installed Qt binding (PyQt or PySide) in your current environment. The simple solution is to simply install one (PyQt5 or 6, or PySide2 or 6) using whatever package manager (pip, conda or OS) you are already using for your Python environment (virtualenv, conda env, etc).

Beyond that, we'll need a lot more information to be able to provide more specific advice. In particular:

  • What are you trying to do?
  • What application are you trying to use QtPy with?
  • In what circumstances does the warning appear?
  • What other behavior/errors are you seeing?
  • What operating system version and versions of Python, Qt, PyQt/PySide, and QtPy are you using?
  • How did you install Python (Python.org, WinPython, Anaconda, distro, etc) and QtPy (Anaconda defaults? Conda-Forge? pip (conda env)? pip (virtualenv)? GitHub clone? Distro package manager?)

Also, please paste the full commands and output you are attempting inside a code block, i.e.

```
<Paste full commands and output here>
```

And also paste the full conda list (if using a conda based Python distribution) or pip list (otherwise) output in the same:

```
<Paste full pip/conda list output>
```

Thanks!

@dalthviz
Copy link
Member

dalthviz commented Jan 9, 2023

Could it be worthy to add some descriptions to the README regarding possible warnings that QtPy can show @CAM-Gerlach ?

@CAM-Gerlach
Copy link
Member

It would probably be worth fully documenting the error and warning hierarchy defined in __init__, yeah, at least at some point. However, at least in terms of end user interpretation (as appears to be the case here), the messages themselves should be clear and easy enough to understand on their own first and foremost—and right now, there's only one general warning defined, with a rather inaccurate/outdated docstring, and it isn't even used here (instead, a generic RuntimeWarning is used).

To clean up the warning class, message and docstring while remaining fully backwards compatible, I've opened PR #398

@dalthviz
Copy link
Member

Checking again the OP I think the warning was triggered due to the @jain-brain setup not having PySide6 installed, setting PySide6 as QT_API and importing PyQt5 before importing QtPy. Basically the way to not see the warning is either installing pyside6 in the environment from where QtPy is running or setting the environment variable QT_API to the name of the binding that actually installed (QT_API=pyqt5)

@dalthviz dalthviz changed the title Binding error compatabilty issues Getting RuntimeWarning: Selected binding "pyside6" could not be found, using "pyqt5" what to do? Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants