conda-forge / pyqt-feedstock

A conda-smithy repository for pyqt.
BSD 3-Clause "New" or "Revised" License
5 stars 35 forks source link

No module named 'PyQt5.QtWebKitWidgets' #19

Closed jschueller closed 7 years ago

jschueller commented 7 years ago

I cannot run conda-forge/orange3 (linux/py36) because of missing import:

$ PATH=$HOME/miniconda/bin:$PATH orange-canvas
Traceback (most recent call last):
  File "/home/schueller/miniconda/lib/python3.6/site-packages/Orange/canvas/application/canvasmain.py", line 26, in <module>
    from AnyQt.QtWebEngineWidgets import QWebEngineView
  File "/home/schueller/miniconda/lib/python3.6/site-packages/AnyQt/QtWebEngineWidgets.py", line 4, in <module>
    from PyQt5.QtWebEngineWidgets import *
ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/schueller/miniconda/bin/orange-canvas", line 4, in <module>
    import Orange.canvas.__main__
  File "/home/schueller/miniconda/lib/python3.6/site-packages/Orange/canvas/__main__.py", line 26, in <module>
    from Orange.canvas.application.canvasmain import CanvasMainWindow
  File "/home/schueller/miniconda/lib/python3.6/site-packages/Orange/canvas/application/canvasmain.py", line 29, in <module>
    from AnyQt.QtWebKitWidgets import QWebView
  File "/home/schueller/miniconda/lib/python3.6/site-packages/AnyQt/QtWebKitWidgets.py", line 14, in <module>
    from PyQt5.QtWebKitWidgets import *
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

It works if I install pyqt/qt from defaults.

ccordoba12 commented 7 years ago

Could you try with other Python versions?

jschueller commented 7 years ago

Yes, same thing with 2.7, 3.5: PyQt5.QtWebKitWidgets is not available (still on linux).

mingwandroid commented 7 years ago

Can you try without the trailing / in your new PATH entry, and also add a $ before the 2nd PATH, i.e. change: PATH=$HOME/miniconda/bin/:PATH orange-canvas to PATH=$HOME/miniconda/bin:$PATH orange-canvas

jschueller commented 7 years ago

oups, no, the bug is still present, comes down to:

PATH=$HOME/miniconda/bin:$PATH python -c "from PyQt5.QtWebKitWidgets import *"
astaric commented 7 years ago

The actual problem is a few lines above

ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'

When it is not found, AnyQt falls back to QtWebKit, which was available in older versions of qt. As of why PyQt5.QtWebEngineWidgets is not available, I have no idea.

As pyqt/qt from defaults seem to work just fine, I use

conda install -c defaults pyqt=5 qt

as a workaround.

astaric commented 7 years ago

Never mind, I have just checked, qt from defaults channel includes QtWebKit. PyQt5 from pypi is the one that has QtWebEngine.

mingwandroid commented 7 years ago

As of why PyQt5.QtWebEngineWidgets is not available, I have no idea.

This may be because QtWebEngine can only be compiled and run on very modern operating system releases.

ccordoba12 commented 7 years ago

As of why PyQt5.QtWebEngineWidgets is not available, I have no idea.

Conda packages don't provide those widgets because they require C++11 capable compilers and more modern Linux versions than those supported by Continuum (i.e. CentOS 5).

gillins commented 7 years ago

So do we need to be building qt with WebKit like we do on Windows? See https://github.com/conda-forge/qt-feedstock/blob/master/recipe/bld.bat#L34

jschueller commented 7 years ago

so it's not the lack of cxx11

mingwandroid commented 7 years ago

It is the lack of c++11 (on Windows) and on centos5, for defaults, the lack of modern glibc, kernel and opengl.

If c++11 wasn't a show stopper on Windows I would have tried to figure a way of getting webengine to work as well as I could on Linux as then we'd have had uniformity across all OSes.

ccordoba12 commented 7 years ago

To be a bit more specific, the problem is with supporting WebEngine is Python 2.7 on Windows.

Besides, WebKit and WebEngine have some (minor but annoying) incompatibilities. So in the spirit of maintaining compatibility between conda-forge and defaults, I'd prefer conda-forge to continue using WebKit.

In any case, the problem here is the lack of WebKit in Qt5. I thought it was compiled correctly... @ocefpaf?

astaric commented 7 years ago

any updates on this?

jschueller commented 7 years ago

the bug is still there

BrenBarn commented 7 years ago

What is the long-term plan here? QtWebKit is deprecated and is gone in Qt 5.6. Although I think it has some advantages over QtWebEngine, people are going to be caught in the middle if QtWebKit is gone and QtWebEngine isn't yet provided. There is a "reboot" of QtWebKit that would be cool if it could somehow be set up as a conda package to integrate with PyQt5.

gillins commented 7 years ago

AFAIK QtWebit is built as part of the Qt build on Linux (https://github.com/conda-forge/qt-feedstock/blob/master/recipe/bld.bat#L40) and Windows (https://github.com/conda-forge/qt-feedstock/blob/master/recipe/build.sh#L9). I think @mingwandroid worked out how to do this originally.

On my Linux box I definitely have a libQt5WebKit.so installed in my Conda env.

Is the problem that pyqt isn't picking up we have Webit rather than WebEngine?

BrenBarn commented 7 years ago

Interesting, you're right. Is the plan to continue supporting and supplying that independently of the upstream Qt?

gillins commented 7 years ago

I think so. At least until Python 2.7 goes away on Windows and the gcc used for building on Linux is upgraded. @ccordoba12 and @ocefpaf probably have more insight here...

ccordoba12 commented 7 years ago

We haven't started to consider when we're going to move to a more recent Qt version. But when we do, I think we will also move from QtWebkit to QtWebengine.

gillins commented 7 years ago

@jschueller can you confirm whether this has been fixed? from PyQt5.QtWebKitWidgets import QWebView seems fine on Linux now....

BrenBarn commented 7 years ago

My concern is that there appears to be no combination of web engine widget and future support. Right now we have QtWebKit, which is great, but I don't want to depend on that that unless there's a clear intention to continue providing it in the future. The alternative is QtWebEngine, which is what Qt apparently has committed to supporting in the future, but that's not available. So people trying to write reasonably future-proof code are caught in the middle.

thidev commented 7 years ago

Hi Guys, I know you are talking about QtWebKit (that is gone in Qt 5.6.) and now there is this PyQt5.QtWebEngineWidgets (that's not available). How can I create a browser page with QT5 so? I just want to make this code(in the example) https://pythonspot.com/en/pyqt5-browser/ work. Please, give me some direction, I have been searching for days that things...

ccordoba12 commented 7 years ago

Use QtWebKit instead of QWebEngine. Their APIs are mostly the same.

carlobianchi89 commented 7 years ago

Is there any version of QT Designer that uses QtWebKit instead of QWebEngine with PyQt5? I would like to design a GUI with QTDesigner on Windows and I would like to add a web browser. I can use QtWebKit, as suggested by @ccordoba12, but it seems that with any version of PyQt5, QT Designer uses QWebEngine.

SylvainCorlay commented 5 years ago

@ccordoba12 it seems from the original post that qtwebkit is also missing from pyqt5 which makes it impossible to launch spyder from a conda-forge install.

ccordoba12 commented 5 years ago

@SylvainCorlay, there's is a test that verifies its presence:

https://github.com/conda-forge/pyqt-feedstock/blob/d4494c07ac858f4e5bb63d1104e1de19c6e57d2f/recipe/meta.yaml#L56

but it's not activated for macOS (I don't know why). Is your problem related only to that platform?

pgunn commented 5 years ago

@ccordoba12 I have only seen it on OSX (Sylvain poked you on my behalf)

jyu13 commented 5 years ago

I have the same issue. I have no idea how it occurs. Tried many ways to solve, unfortunately failed all. So I delete anaconda using command line and reinstall everything and it worked.

PrognosticatorR commented 5 years ago

this is problem with pyqt5 version you can try pip install pyqt5==pyqt5.8 or same for conda , i think this can help

mappedinn commented 5 years ago

If running spyder from the terminal returns the following issue:

Traceback (most recent call last):
  File "C:\Users\999138\AppData\Local\Continuum\anaconda3\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 22, in <module>
    from PyQt5.QtWebEngineWidgets import QWebEnginePage
ImportError: DLL load failed: The specified procedure could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\999138\AppData\Local\Continuum\anaconda3\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\999138\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\app\start.py", line 186, in main
    from spyder.app import mainwindow
  File "C:\Users\999138\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 90, in <module>
    from qtpy import QtWebEngineWidgets  # analysis:ignore
  File "C:\Users\999138\AppData\Local\Continuum\anaconda3\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 26, in <module>
    from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

It is then a bug.

Overcoming the bug is in done 2 steps:

Step 1

conda update -c conda-forge qt pyqt

Step 2

Launch spyder from Anaconda Navigator, not for the terminal.

This applies for Microsoft Windows 10.

PS: to get back to the official repository, please the channel pkgs/main

conda update -c pkgs/main qt pyqt
mingwandroid commented 5 years ago

If running spyder from the terminal returns the following issue:

You are meant to use The Anaconda Prompt or else activate your conda env manually.

mappedinn commented 5 years ago

What I was talking about is the Windows terminal.

Summary

I hope my answer is clearer.

ccordoba12 commented 5 years ago

Why do you need to use conda-forge in the first place?

mingwandroid commented 5 years ago

What I was talking about is the Windows terminal.

This is unsupported unless you activate your conda env.

I hope my answer is clearer.

Your bug report is irrelevant since we do not support non-activation.

wizofe commented 5 years ago

pip install PyQtWebEngine solved it for me.

EXBureau commented 5 years ago

pip install PyQtWebEngine solved it for me.

Just solved my case too (on Win8). Thanks!

tth030 commented 5 years ago

Solved it for me (MacOsX@10.12.6 - python@3.6.5). Thanks.

liyzcj commented 5 years ago

pip install PyQtWebEngine solved it for me.

Solved my case ( win10 ) Thanks.. totaly, If you use pip install spyder then you need pip install PyQtWebEngine

Finally you can run spyder3.exe on cmd or powershell

Russell-Jones-OxPhys commented 5 years ago

pip install --upgrade PyQtWebEngine ?

pip install PyQtWebEngine solved it for me.

Solved my case ( win10 ) Thanks.. totaly, If you use pip install spyder then you need pip install PyQtWebEngine

Finally you can run spyder3.exe on cmd or powershell

Any reason this isn't a dependency of spyder?

mappedinn commented 5 years ago

I did a mistake.

I am used to work on linux, So when I started working on Windows 10, the command line spyder returns me that error (PyQtWebEngine is missing.)

To cut it short, Windows 10 needs that you do the following commands:

And every thing will run smoothly.

:)

msarahan commented 5 years ago

@Russell-Jones-OxPhys

Any reason this isn't a dependency of spyder?

It would be foolish for spyder to specify a source of software. Software may specify dependencies, but it should not constrain where those dependencies come from.

You're finding a solution that may break other software. Other programs that have been compiled against a different version of Qt may break with the way you've done things. Our advice here has been to activate your environments. There's also an environment variable you can set to change our python's DLL search behavior. This is described in https://conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#numpy-mkl-library-load-failed.

The problem is not that qtwebengine is missing from conda-forge's pyqt. The problem is that it is present, but without activation, python does not know how to find it. Good luck.

Russell-Jones-OxPhys commented 5 years ago

@msarahan I don't recall finding any solution, rather asking a question. Thank you for answering it. I don't think it would be foolish, rather convenient, however I can see that the different ways of working that conda and virtualenv have conflict. it seems the solution for a conda environment is quite different from a stand-alone virtualenv, though it's not clear to me why dependencies specified in PyPI limit those available to conda-- is it to allow for the case where a virtualenv is layered on top of a conda env?

Hassanzadeh-sd commented 5 years ago

you can try one of these solution ,

install old version :

pip install PyQt5==5.11.3

or install :

pip install PyQtWebEngine

I have same problem and solved with this solution.

zcq0730 commented 5 years ago

This works for me: In windows 10 (run this in conda prompt, might need to run as admin)

conda install --force-reinstall pyqt qt

see here: https://github.com/spyder-ide/spyder/issues/6934

SurajMeena commented 5 years ago

I solved same issue by installing qt bindings from conda web page, https://anaconda.org/anaconda/pyqt.

kamrankausar commented 5 years ago

Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/qtpy/QtWebEngineWidgets.py", line 22, in from PyQt5.QtWebEngineWidgets import QWebEnginePage ImportError: No module named 'PyQt5.QtWebEngineWidgets'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/spyder3", line 11, in sys.exit(main()) File "/usr/local/lib/python3.5/dist-packages/spyder/app/start.py", line 144, in main from spyder.app import mainwindow File "/usr/local/lib/python3.5/dist-packages/spyder/app/mainwindow.py", line 92, in from qtpy import QtWebEngineWidgets # analysis:ignore File "/usr/local/lib/python3.5/dist-packages/qtpy/QtWebEngineWidgets.py", line 26, in from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage ImportError: No module named 'PyQt5.QtWebKitWidgets'

TidyData commented 5 years ago

I experienced this issue on RHEL 7 and after installing libXScrnSaver-1.2.2-6.1.el7 the issue was resolved.