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

qtwebkit used, release overdue #98

Open
gdt opened this issue Nov 26, 2024 · 11 comments · May be fixed by #99
Open

qtwebkit used, release overdue #98

gdt opened this issue Nov 26, 2024 · 11 comments · May be fixed by #99

Comments

@gdt
Copy link

gdt commented Nov 26, 2024

I'm running qgis on NetBSD via pkgsrc, and qtwebkit has been removed, in favor of a chrome-based webview. This plugin is now failing to load. I see the last release was a long time ago.

Could someone comment on

  • whether it's a bug to be still using qtwebkit?
  • is this plugin still maintained?
  • if not, any comparable plugins that are maintained?

Thanks,
Greg

@gdt
Copy link
Author

gdt commented Nov 26, 2024

Apparently it is a bug to be using qtwebkit.

https://doc.qt.io/qt-5/qtwebenginewidgets-qtwebkitportingguide.html

@NyakudyaA
Copy link
Collaborator

@gdt what QGIS version are you running there ?

@gdt
Copy link
Author

gdt commented Nov 27, 2024

QGIS 3.34.13-Prizren 'Prizren' (exported)

@NyakudyaA NyakudyaA linked a pull request Dec 28, 2024 that will close this issue
@NyakudyaA
Copy link
Collaborator

@gdt I tried to check where we are using qtwebkit and did a PR, could you check if that resolves the issue for you? If not could you please install the https://plugins.qgis.org/plugins/firstaid/ and share with me the stack trace you get when you try to start the plugin

@gdt
Copy link
Author

gdt commented Dec 28, 2024

I uninstalled the released version of the plugin. I cloned the repo and checked out the webkit branch. i zipped it up, and did install plugin from zip. It still fails, but with firstaid I have more insight.

In utilities.py, get_ui_class, the try/except around the import

from PyQt5.QtWebEngineWidgets import QWebEngineView

ends up setting the variables according to the else branch. That seems wrong, but I edited the code to not import and just use the webengine tokens, so I/we can debug why the import fails separately.

After forcing to QWebEngineView, I still got an import error:

cannot import name 'QtWebKitWidgets' from 'PyQt5' (/usr/pkg/lib/python3.12/site-packages/PyQt5/__init__.py)

and looking at local variables I see that nothing was substituted into ui_file_path and I don't understand how that is supposed to work.

ui_file_path = {str} '/home/gdt/.local/share/QGIS/QGIS3/profiles/default/python/plugins/parcel_plugin/ui_crsselector.ui

@gdt
Copy link
Author

gdt commented Dec 29, 2024

In ui_crsselector.ui I still find

 <customwidgets>
  <customwidget>
    <class>QWebView</class>
    <extends>QWidget</extends>
    <header>PyQt4.QtWebKit</header>
  </customwidget>

@NyakudyaA
Copy link
Collaborator

NyakudyaA commented Dec 29, 2024

@gdt Can you please make sure that the QWebEngineView is installed. Try the following:

  • Delete the old ./__pycache__ folder

  • Open the QGIS console and type the following

import pip
pip.main(['install', 'PyQtWebEngine'])

Then you can run the import

from PyQt5.QtWebEngineWidgets import QWebEngineView

@gdt
Copy link
Author

gdt commented Dec 29, 2024

I did not explicitly clear pycache (in the parcel_plugin dir) but the mod times all track the sources.

I can run that import from system python with no errors. I am using qgis packaged in pkgsrc, where all the python modules are in the system load path.

$ ls -l /usr/pkg/lib/python3.12/site-packages/PyQt5/QtWebEngine*
-rwxr-xr-x  1 root  wheel   92072 Dec 29 08:53 /usr/pkg/lib/python3.12/site-packages/PyQt5/QtWebEngine.abi3.so
-rwxr-xr-x  1 root  wheel  178920 Dec 29 08:53 /usr/pkg/lib/python3.12/site-packages/PyQt5/QtWebEngineCore.abi3.so
-rwxr-xr-x  1 root  wheel  417008 Dec 29 08:53 /usr/pkg/lib/python3.12/site-packages/PyQt5/QtWebEngineWidgets.abi3.so

I see lots of (c++ mangled) symbols that make sense.

But, progress in diagnosing: I opened the python console and pasted it, and got:

# Python Console
# Use iface to access QGIS API interface or type '?' for more info
# Security warning: typing commands from an untrusted source can harm your computer
>>> from PyQt5.QtWebEngineWidgets import QWebEngineView
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/pkg/share/qgis/python/qgis/utils.py", line 892, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: QtWebEngineWidgets must be imported or Qt.AA_ShareOpenGLContexts must be set before a QCoreApplication instance is created

@gdt
Copy link
Author

gdt commented Dec 29, 2024

qgis/QGIS#49512 seems relevant.

@NyakudyaA
Copy link
Collaborator

I did not explicitly clear pycache (in the parcel_plugin dir) but the mod times all track the sources.

I can run that import from system python with no errors. I am using qgis packaged in pkgsrc, where all the python modules are in the system load path.

$ ls -l /usr/pkg/lib/python3.12/site-packages/PyQt5/QtWebEngine*
-rwxr-xr-x  1 root  wheel   92072 Dec 29 08:53 /usr/pkg/lib/python3.12/site-packages/PyQt5/QtWebEngine.abi3.so
-rwxr-xr-x  1 root  wheel  178920 Dec 29 08:53 /usr/pkg/lib/python3.12/site-packages/PyQt5/QtWebEngineCore.abi3.so
-rwxr-xr-x  1 root  wheel  417008 Dec 29 08:53 /usr/pkg/lib/python3.12/site-packages/PyQt5/QtWebEngineWidgets.abi3.so

I see lots of (c++ mangled) symbols that make sense.

But, progress in diagnosing: I opened the python console and pasted it, and got:

# Python Console
# Use iface to access QGIS API interface or type '?' for more info
# Security warning: typing commands from an untrusted source can harm your computer
>>> from PyQt5.QtWebEngineWidgets import QWebEngineView
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/pkg/share/qgis/python/qgis/utils.py", line 892, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I also had the same issue before I installed it with pip. I haven't tested the 3D stuff to see if it still works after my pip install.

ImportError: QtWebEngineWidgets must be imported or Qt.AA_ShareOpenGLContexts must be set before a QCoreApplication instance is created

The other solution would be extensive to refactor the UI selector to use something else if QtWebEngineView and Qt 3d cannot be used at the same time.

@gdt
Copy link
Author

gdt commented Jan 6, 2025

I'm not sure if there is anything else that I should be testing for you, guessing not at this point. It looks like this will be difficult to fix, and I get it things get fixed when someone has enough time and spends it -- so I'm guessing this issue will just remain open until that happens. I'm subscribed to the ticket of course, so feel free to ask me to test if that's helpful.

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.

2 participants