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

PyQt6 support breaks PyQt5 on Ubuntu #369

Closed
machinekoder opened this issue Jun 4, 2021 · 7 comments · Fixed by #370
Closed

PyQt6 support breaks PyQt5 on Ubuntu #369

machinekoder opened this issue Jun 4, 2021 · 7 comments · Fixed by #370

Comments

@machinekoder
Copy link

machinekoder commented Jun 4, 2021

I'm currently facing an issue in my CI which looks related to a recent change in pytest-qt:

The culprit is this line here: https://github.com/pytest-dev/pytest-qt/blob/master/src/pytestqt/qt_compat.py#L144 which was introduced 3 months ago.

System: Ubuntu Focal
Qt version: 5.12.8
PyQt5 version: 5.14.1

log:

INTERNALERROR> Traceback (most recent call last):
18:14:56
  
18:14:56
  INTERNALERROR>   File "/usr/lib/python3/dist-packages/_pytest/main.py", line 202, in wrap_session
18:14:56
  
18:14:56
  INTERNALERROR>     config._do_configure()
18:14:56
  
18:14:56
  INTERNALERROR>   File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 723, in _do_configure
18:14:56
  
18:14:56
  INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
18:14:56
  
18:14:56
  INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 308, in call_historic
18:14:56
  
18:14:56
  INTERNALERROR>     res = self._hookexec(self, self.get_hookimpls(), kwargs)
18:14:56
  
18:14:56
  INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
18:14:56
  
18:14:56
  INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
18:14:56
  
18:14:56
  INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
18:14:56
  
18:14:56
  INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
18:14:56
  
18:14:56
  INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 208, in _multicall
18:14:56
  
18:14:56
  INTERNALERROR>     return outcome.get_result()
18:14:56
  
18:14:56
  INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 80, in get_result
18:14:56
  
18:14:56
  INTERNALERROR>     raise ex[1].with_traceback(ex[2])
18:14:56
  
18:14:56
  INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
18:14:56
  
18:14:56
  INTERNALERROR>     res = hook_impl.function(*args)
18:14:56
  
18:14:56
  INTERNALERROR>   File "/usr/local/lib/python3.8/dist-packages/pytestqt/plugin.py", line 203, in pytest_configure
18:14:56
  
18:14:56
  INTERNALERROR>     qt_api.set_qt_api(config.getini("qt_api"))
18:14:56
 INTERNALERROR>   File "/usr/local/lib/python3.8/dist-packages/pytestqt/qt_compat.py", line 144, in set_qt_api
18:14:56
  
18:14:56
  INTERNALERROR>     self.isdeleted = _import_module("sip").isdeleted
18:14:56
  
18:14:56
  INTERNALERROR>   File "/usr/local/lib/python3.8/dist-packages/pytestqt/qt_compat.py", line 101, in _import_module
18:14:56
  
18:14:56
  INTERNALERROR>     return getattr(m, module_name)
18:14:56
  
18:14:56
  INTERNALERROR> AttributeError: module 'PyQt5' has no attribute 'sip'
18:14:56
  
18:14:56
  [Testcase: testtest_lib] ... FAILURE!
18:14:56
  
  
@nicoddemus
Copy link
Member

Hi @machinekoder,

Can you try this in your environment please?

>>> import PyQt5.sip
>>>

@The-Compiler
Copy link
Member

Right, either Ubuntu or Debian seems to patch PyQt in a way which is incompatible with how upstream (and almost any other distribution) do things. See qutebrowser/qutebrowser#6082 and qutebrowser/qutebrowser@41087d3.

I suppose we can work around this in pytest-qt as well, but I'd also like to find out if this is due to Debian or Ubuntu, and then report it there.

@reneeotten
Copy link

I am seeing the same issue when packaging the update for MacPorts

@The-Compiler
Copy link
Member

Could someone test #370 please, ideally both with PyQt5 and PyQt6?

@reneeotten
Copy link

Could someone test #370 please, ideally both with PyQt5 and PyQt6?

thanks @The-Compiler - works for me with PyQt5. Sorry, MacPorts hasn't ported PyQt6 yet so I didn't test it with that...

@machinekoder
Copy link
Author

Hi @machinekoder,

Can you try this in your environment please?

>>> import PyQt5.sip
>>>
Python 3.8.5 (default, May 27 2021, 13:30:53) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5.sip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.sip'

@The-Compiler
Copy link
Member

4.0.1 with the fix is out now. Thanks @machinekoder @reneeotten for the report and testing!

The-Compiler added a commit to The-Compiler/pytest-qt that referenced this issue Jun 13, 2021
This has caused us a lot of trouble since the 4.0.0 release
(see pytest-dev#369 and pytest-dev#373). However, it was only neeeded for tests, where we
might as well just check if the object is alive by calling a Qt method
and checking for the exception (RuntimeError with all Qt APIs).

Fixes pytest-dev#373
The-Compiler added a commit that referenced this issue Jun 13, 2021
This has caused us a lot of trouble since the 4.0.0 release
(see #369 and #373). However, it was only neeeded for tests, where we
might as well just check if the object is alive by calling a Qt method
and checking for the exception (RuntimeError with all Qt APIs).

Fixes #373
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

Successfully merging a pull request may close this issue.

4 participants