0

I created a new Anaconda environment with Python 3.6. I installed PyQt5 with pip install PyQt5. I have this butt-simple program:

from PyQt5 import QtWidgets
#from PyQt5 import QtWebEngineWidgets

app = QtWidgets.QApplication([])

As written, it runs (and does nothing). If I uncomment the QtWebEngineWidgets line, it crashes. If I leave that line uncommented, but comment out the final line, it no longer crashes. In other words, it crashes when trying to create the application, but only if I previously tried to import QtWebEngineWidgets. Importing QtWebEngineWidgets itself doesn't cause a crash unless I try to create an application.

I'm running this on Windows 7. The crash is a "hard" crash: it's not a Python exception, but a Windows popup saying "Python has stopped working". The info says that the crash is in "atio6axx.dll". Googling around I see some hints that there could be some sort of conflict between Qt and my graphics driver, but I don't know how to debug it, let alone fix it. (I have an embedded graphics controller that shows as ATI Radeon HD 4250.)

conda list qt shows:

 PyQt5                     5.8.2                     <pip>

What can I do to be able to use QtWebEngine successfully?

BrenBarn
  • 242,874
  • 37
  • 412
  • 384
  • What is the output of `conda list qt`? I have found that installing PyQt with Pip into an Anaconda environment can break the pyqt conda package, even across environments. From [the answer](https://github.com/ContinuumIO/anaconda-issues/issues/1554#issuecomment-289230000) I got by the Anaconda developers, I infer you should only install PyQt with `conda` when you are using Anaconda. I recommend to do that because otherwise it will be very difficult, if not impossible, to ensure that the pip and conda versions of PyQt don't mix. – titusjan Jun 05 '17 at 07:16
  • @titusjan: I edited the question to include that output. But if what you say is true, it would seem to mean that it is impossible to use the most recent version of PyQt with Anaconda at all, since conda's version is only 5.6. Is this really the case? – BrenBarn Jun 05 '17 at 08:37
  • Also, the PyQt5 install in this environment seems to be working apart from this issue, so (knock on wood) things aren't broken as badly as they seemed to be for you. I can still, for instance, run Spyder and IPython QtConsole successfully. – BrenBarn Jun 05 '17 at 08:52
  • Yes, I believe that you are currently limited to PyQt 5.6 if you use Anaconda. Its design philosophy is that an environment can have only one version of a package at the time. You now have two versions of the Qt DLLs in your environment. I don't know the details but they could interfere (I could be wrong of course). What is the output of `python -c "from PyQt5 import QtWebEngineWidgets; print(QtWebEngineWidgets.__file__)"`? You can also use the `python -v` argument (either in this command or when running your program) to see which DLL files are accessed. Use `-v -v` for more verbose info. – titusjan Jun 05 '17 at 12:08
  • @titusjan: Oops, the conda list output I showed was wrong (it was from a different environment). I corrected the output above.) My experience is somewhat different than what you describe in the github issue. If I run your command I get a path inside my env which seems as it should be. Also, this is different from the behavior I get if (in a different environment) I install the conda pyqt over my pip PyQt5. If I have only pip PyQt5, I get the crash. If I have conda pyqt installed over pip PyQt5, then trying to import QtWebEngineWidgets fails immediately with a DLL load error. – BrenBarn Jun 05 '17 at 19:03
  • And what happens if you have installed pyqt with conda only? So installed in an Anaconda distribution that is not broken by pip-installs of PyQt in other environments? – titusjan Jun 06 '17 at 12:59
  • @titusjan: That version of PyQt seems not to include QtWebEngine at all. I get an ImportError saying the module is not found. – BrenBarn Jun 06 '17 at 17:57

2 Answers2

0

In my experience this issue has nothing to do with PyQt being installed using both pip and anaconda, although this would cause an problem too. If you only have pyqt installed on Anaconda the following code my cause a hard crash:

from qtpy import QtWidgets
from qtpy import QtWebEngineWidgets
app = QtWidgets.QApplication([])

We started experiencing this on a number of computers after an "upgrade" to windows 10, and noticing Spyder stopped working. It exited without an error message. The IT guys tracked it down to the graphics card.

Solutions: downgrade pyqt to version 5.6: conda install pyqt=5.6

Mohrez
  • 11
  • 3
-1

I'm seeing this behavior on a windows 10 machine currently as well.
I use qtpy as well but have done this same example in just PyQt5.

Downgraded to 5.6 changes other behavior li

Ross Hytnen
  • 214
  • 1
  • 5