Opened 6 years ago

Closed 6 years ago

#58237 closed defect (fixed)

py-spyder: py-pyqt5 dependency also needs +webkit

Reported by: mf2k (Frank Schima) Owned by: reneeotten (Renee Otten)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: mamoll (Mark Moll)
Port: py-spyder py-pyqt5

Description (last modified by mf2k (Frank Schima))

Something changed recently because py-spyder now needs py-pyqt5 +webengine +webkit, but the portfile only requires +webengine. Here is the runtime error I see with only that variant:

$ spyder
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/qtpy/QtWebEngineWidgets.py", line 22, in <module>
    from PyQt5.QtWebEngineWidgets import QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/local/bin/spyder", line 3, in <module>
    start.main()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/spyder/app/start.py", line 193, in main
    from spyder.app import mainwindow
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/spyder/app/mainwindow.py", line 81, in <module>
    from qtpy import QtWebEngineWidgets  # analysis:ignore
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/qtpy/QtWebEngineWidgets.py", line 26, in <module>
    from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

Change History (19)

comment:1 Changed 6 years ago by mf2k (Frank Schima)

Port: py-spyder added; py-spyder-devel removed

comment:2 Changed 6 years ago by mf2k (Frank Schima)

Description: modified (diff)

comment:3 Changed 6 years ago by reneeotten (Renee Otten)

this is likely caused by the recent update of py-pyqt5 where the QtWebEngine stuff was separated into an different package (see here). I wasn't aware of this change and probably the maintainer of py-pyqt5 didn't notice either - I'll take a closer look tonight or tomorrow.

comment:4 Changed 6 years ago by reneeotten (Renee Otten)

okay, PyQtWebEngine is now released separate thing from pyqt5 (see here). In the py-pyqt5 port, the qtwebengine variant does not do anything anymore and that causes spyder to fail.

On the one had, it could make sense to download the source file for PyQtWebEngine and install it within the py-pyqt5 port since we would want to keep those in sync anyway, but we can also make a separate port and have the +webengine variant depend on it. The latter would have the advantage that py-spyder can just add a dependency and that port and does not a need non-default variant from py-pyqt5 anymore that currently makes its build fail on the buildbot. Alternatively, we can enable the webengine part by default in the py-pyqt5 port, but I don't know if there are drawbacks to that.

Frank: as this related to the py-pyqt5 port can you please add that port and @mamoll to this ticket (I still don't have permissions) so that we can get his opinion on this and figure out how to proceed?

comment:5 Changed 6 years ago by mf2k (Frank Schima)

Cc: mamoll added
Port: py-pyqt5 added

comment:6 Changed 6 years ago by mf2k (Frank Schima)

I vote for just always enabling webengine in py-pyqt5 or adding a new sub-port for it. The current (now non-functioning) situation of depending on a variant is not good and does not allow for a compiled binary on the buildbots.

Last edited 6 years ago by mf2k (Frank Schima) (previous) (diff)

comment:7 Changed 6 years ago by mamoll (Mark Moll)

A support seems like the way to go, but it'd replicate a lot of the pyXX-pyqt5 code. Does anyone have any ideas on how to do this more elegantly?

comment:8 Changed 6 years ago by mf2k (Frank Schima)

Maybe I'm not understanding what you are asking. By making it a sub-port of py-pyqt5, you only need to add lines for what is different between the ports and thus there will be no duplication of lines.

comment:9 Changed 6 years ago by mamoll (Mark Moll)

Maybe I am not sure what needs to be done. I thought what you meant was:

  • Create subport py27-pyqt5-webkit, ..., py37--pyqt5-webkit
  • Each will be built similar to the corresponding py??-pyqt5 support:
        PortGroup           qmake5 1.0
    
        # pull in the Qt5 meta-port
        qt5.depends_component \
                            qtscript \
                            qt3d \
                            qt5
        depends_lib-append  port:py${python.version}-sip \
                            port:dbus-python${python.version}
    
        if {${python.version} == 27} {
            depends_lib-append port:py27-enum34
        }
    
        use_configure       yes
        configure.pre_args
        configure.cmd       "${python.bin} configure.py"
        qt5.spec_cmd        --spec=
        configure.args-append \
                            -q ${qt_qmake_cmd} \
                            --verbose \
                            --confirm-license \
                            --sip=${prefix}/bin/sip-${python.branch} \
                            --dbus=${python.include}/dbus-1.0 \
                            --designer-plugindir=${qt_plugins_dir}/designer/Py${python.version}Qt5 \
                            --qml-plugindir=${qt_plugins_dir}/Py${python.version}Qt5 \
                            --no-dist-info
    

comment:10 Changed 6 years ago by mf2k (Frank Schima)

Yes, that is exactly the thinking! This sub-port can, in theory, be added inside the existing py-pyqt5 Portfile. Although since the pyXY ports are already sub-ports from the python portgroup, it is a little more complicated.

comment:11 Changed 6 years ago by mf2k (Frank Schima)

Yes, it looks like you just create another block like the existing py-pyqt5-common sub-port:

if {${subport} eq "${name}-common"} {
...
} elseif {${subport} eq "${name}-webkit"}
[new code here]
}

comment:12 Changed 6 years ago by reneeotten (Renee Otten)

I would prefer then to just add the additional code in the already existing webengine variant instead of making another sub-port, wouldn't that be the easiest (and than making this a default variant)?

Last edited 6 years ago by reneeotten (Renee Otten) (previous) (diff)

comment:13 Changed 6 years ago by mamoll (Mark Moll)

The qtwebkit dependency is quite large, so a default variant would require *everyone* to install a whole bunch of extra stuff, even if they don't need it. A subport seems cleaner: it will still be built by the buildbot and other ports can depend on it.

Last edited 6 years ago by mamoll (Mark Moll) (previous) (diff)

comment:14 Changed 6 years ago by mf2k (Frank Schima)

Yes, qtwebkit really needs to be in a sub-port such that py-spyder(-devel) can directly depend on it.

comment:15 Changed 6 years ago by reneeotten (Renee Otten)

okay, a sub-port it is then ;) Next question: Mark do you want me to try this and submit a PR, or do you prefer to take care of this yourself?

comment:16 Changed 6 years ago by mamoll (Mark Moll)

I don't have time to work on this anytime soon. If you could create a PR, that'd be great. You can use this diff as a starting point:

diff --git a/python/py-pyqt5/Portfile b/python/py-pyqt5/Portfile
index 8b55495116..5a93c9e765 100644
--- a/python/py-pyqt5/Portfile
+++ b/python/py-pyqt5/Portfile
@@ -24,6 +24,9 @@ checksums               rmd160  bfe5376baf97bde0ebad0fd7f109e23ff3242975 \
 
 python.versions 27 34 35 36 37
 subport "${name}-common" {}
+foreach pv ${python.versions} {
+    subport "py${pv}-pyqt5-webkit" {}
+}
 
 if {${subport} eq "${name}-common"} {
     description-append          (.sip sourcefiles)
@@ -41,6 +44,27 @@ if {${subport} eq "${name}-common"} {
         file copy {*}[glob -directory ${worksrcpath}/sip/ Q*] ${destroot}${prefix}/share/sip/PyQt5
         file copy ${worksrcpath}/sip/Enginio ${destroot}${prefix}/share/sip/PyQt5
     }
+} elseif {${subport} eq "${name}-webkit"} {
+    PortGroup           qmake5 1.0
+    description         "PyQt5 Webkit bindings"
+    long_description    "${description}"
+    master_sites        https://www.riverbankcomputing.com/static/Downloads/PyQtWebEngine/${version}
+    distname            PyQtWebEngine_gpl-${version}.tar.gz
+    depends_lib-append   port:py${python.version}-pyqt5
+    use_configure       yes
+    configure.pre_args
+    configure.cmd       "${python.bin} configure.py"
+    qt5.spec_cmd        --spec=
+    configure.args-append \
+                        -q ${qt_qmake_cmd} \
+                        --verbose \
+                        --confirm-license \
+                        --sip=${prefix}/bin/sip-${python.branch} \
+                        --dbus=${python.include}/dbus-1.0 \
+                        --designer-plugindir=${qt_plugins_dir}/designer/Py${python.version}Qt5 \
+                        --qml-plugindir=${qt_plugins_dir}/Py${python.version}Qt5 \
+                        --no-qsci-api \
+                        --no-dist-info
 } elseif {${name} ne ${subport}} {
     PortGroup           qmake5 1.0
 

comment:17 Changed 6 years ago by mamoll (Mark Moll)

You may also want to investigate whether you want to depend on QtWebEngine vs QtWebkit. Not sure which is the preferred option...

comment:18 Changed 6 years ago by reneeotten (Renee Otten)

see PR3951

comment:19 Changed 6 years ago by reneeotten <reneeotten@…>

Resolution: fixed
Status: assignedclosed

In 369e2eb0c61e943166a3b2453e311602ea30887d/macports-ports (master):

py-spyder[-devel]: depend on py-pyqt5-webengine

Closes: #58237

Note: See TracTickets for help on using tickets.