cortex-lab / phy

phy: interactive visualization and manual spike sorting of large-scale ephys data
BSD 3-Clause "New" or "Revised" License
314 stars 157 forks source link

DLL load failed while importing QtWebEngineWidgets: #1172

Open dmkobylkov opened 2 years ago

dmkobylkov commented 2 years ago

Hi! I have created an environment in conda, installed thy phy in there, but I still cannot open the template gui. I always get the following error. Uninstalling and reinstalling of the QtWebEngineWidgets doesn't help. Could you help me to solve the problem? Thanks!

(phy2) C:\Users\dmitry.kobylkov\MATLAB\Projects\KilosortPLX\Outputs-chick46_160622_1.7.pl213-Sep-2022>phy template-gui params.py --debug
Traceback (most recent call last):
  File "C:\Users\dmitry.kobylkov\.conda\envs\phy2\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\dmitry.kobylkov\.conda\envs\phy2\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\dmitry.kobylkov\.conda\envs\phy2\Scripts\phy.exe\__main__.py", line 4, in <module>
  File "C:\Users\dmitry.kobylkov\.conda\envs\phy2\lib\site-packages\phy\apps\__init__.py", line 22, in <module>
    from phy.gui.qt import QtDialogLogger
  File "C:\Users\dmitry.kobylkov\.conda\envs\phy2\lib\site-packages\phy\gui\__init__.py", line 6, in <module>
    from .qt import (
  File "C:\Users\dmitry.kobylkov\.conda\envs\phy2\lib\site-packages\phy\gui\qt.py", line 41, in <module>
    from PyQt5.QtWebEngineWidgets import (QWebEngineView,  # noqa
ImportError: DLL load failed while importing QtWebEngineWidgets: The specified module could not be found.
mariehemelt commented 2 years ago

I am having the same error as of 9/21. I am able to run phy successfully on this machine in a different environment but when I install the developer version I get this error. Uninstalling and reinstalling PyQtWebEngine didn't help.

C:\Users\mh553\Phy\phylib-master\phylib-master>phy template-gui params.py Traceback (most recent call last): File "C:\Users\mh553\Anaconda3\envs\ForPhyllum\Scripts\phy-script.py", line 33, in sys.exit(load_entry_point('phy', 'console_scripts', 'phy')()) File "C:\Users\mh553\Anaconda3\envs\ForPhyllum\Scripts\phy-script.py", line 25, in importlib_load_entry_point return next(matches).load() File "C:\Users\mh553\Anaconda3\envs\ForPhyllum\lib\importlib\metadata.py", line 86, in load module = import_module(match.group('module')) File "C:\Users\mh553\Anaconda3\envs\ForPhyllum\lib\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "c:\users\mh553\phy\phy-master\phy-master\phy\apps__init.py", line 22, in from phy.gui.qt import QtDialogLogger File "c:\users\mh553\phy\phy-master\phy-master\phy\gui\init__.py", line 6, in from .qt import ( File "c:\users\mh553\phy\phy-master\phy-master\phy\gui\qt.py", line 41, in from PyQt5.QtWebEngineWidgets import (QWebEngineView, # noqa ImportError: DLL load failed while importing QtWebEngineWidgets: The specified module could not be found.

rhayman commented 2 years ago

A colleague had the same problem which we were able to fix:

pip uninstall PyQt5 pip uninstall PyQt5-sip pip uninstall PyQtWebEngine

pip install --upgrade pyqtwebengine==5.12 pip install --upgrade pyqt5==5.12.3

(the specific versions listed above were the lowest ones pypi was offering at the time)

You may need to manually remove the PyQt folders in Lib\site-packages and repeat the above steps but we didn't need to.

hwehry commented 1 year ago

Hello,

A colleague and I are having a similar error as of 12/8/22 (see attached), apparently with the PyQt5 and PyQTWebEngine packages. We tried performing a completely fresh install and following the instructions above, i.e. uninstalling and reinstalling earlier versions of pyqt5 and pyqtwebengine , to no avail.

Has there been a developer update for this issue?

phy2_error

hwehry commented 1 year ago

I finally found a solution that worked for my colleague and I.

Order of events:

  1. Install Anaconda

  2. Create an Anaconda environment with the major dependencies. The earlier versions of pyqt5/pyqt5-sip/pyqtwebengine are not available when installing, so I withheld the "pyqt" install for a later pip install.

conda create -n phy2 python=3.7 pip numpy matplotlib scipy scikit-learn h5py cython pillow -y

  1. Confirm that there are no pyqt related packages. If there are, then use the conda uninstall commands to remove them.

conda list

  1. Use pip to install the earliest possible recommended version of pyqt. Note that "pqt5" must be installed before the webengine. Otherwise the later version of pyqt5 is installed as part of the dependencies of the webengine, and installing the earlier version over it still results in the DLL load failure error seen above.

pip install pyqt5==5.12.1 pip install pyqtwebengine==5.12

using conda list also shows that ppyqt5-sip 4.19.19 is installed

  1. Proceed to install phy and run it as usual.

pip install phy --pre --upgrade

tkskdm2 commented 1 year ago

It worked beautifully, thanks hwehry!!!

moscraciunxxx commented 1 year ago

@hwehry Thank you for your suggestions. It did the job!

rahim-hashim commented 1 year ago

Thanks hwehry, this was the best solution to solve my issue as well!