简体   繁体   中英

Error: Failed to enable GUI event loop integration for 'qt' while importing pandas

I use PyCharm Pro 2016.1.4 and pandas 18.1. I'm running into an issue whenever I import pandas. It happened after I updated PyCharm Pro (from 2016.1.3) and IPython 5.

Here's what the console shows me when I start it and then import pandas:

C:\Anaconda2\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 2016.1.4\helpers\pydev\pydevconsole.py" 51602 51603
Python 2.7.12 |Anaconda 2.4.1 (64-bit)| (default, Jun 29 2016, 11:42:13) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 4.0.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
PyDev console: using IPython 4.0.1

import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['C:\\Abc\\Dev\\Code\\abc'])

Python 2.7.12 |Anaconda 2.4.1 (64-bit)| (default, Jun 29 2016, 11:42:13) [MSC v.1500 32 bit (Intel)] on win32
In[2]: import pandas
Backend Qt4Agg is interactive backend. Turning interactive mode on.
Failed to enable GUI event loop integration for 'qt'
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 2016.1.4\helpers\pydev\_pydev_bundle\pydev_console_utils.py", line 544, in do_enable_gui
    enable_gui(guiname)
  File "C:\Program Files (x86)\JetBrains\PyCharm 2016.1.4\helpers\pydev\pydev_ipython\inputhook.py", line 509, in enable_gui
    return gui_hook(app)
  File "C:\Program Files (x86)\JetBrains\PyCharm 2016.1.4\helpers\pydev\pydev_ipython\inputhook.py", line 194, in enable_qt4
    from pydev_ipython.inputhookqt4 import create_inputhook_qt4
  File "C:\Program Files (x86)\JetBrains\PyCharm 2016.1.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Program Files (x86)\JetBrains\PyCharm 2016.1.4\helpers\pydev\pydev_ipython\inputhookqt4.py", line 25, in <module>
    from pydev_ipython.qt_for_kernel import QtCore, QtGui
  File "C:\Program Files (x86)\JetBrains\PyCharm 2016.1.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Program Files (x86)\JetBrains\PyCharm 2016.1.4\helpers\pydev\pydev_ipython\qt_for_kernel.py", line 80, in <module>
    QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
  File "C:\Program Files (x86)\JetBrains\PyCharm 2016.1.4\helpers\pydev\pydev_ipython\qt_loaders.py", line 241, in load_qt
    result = loaders[api]()
  File "C:\Program Files (x86)\JetBrains\PyCharm 2016.1.4\helpers\pydev\pydev_ipython\qt_loaders.py", line 165, in import_pyqt4
    import sip
  File "C:\Program Files (x86)\JetBrains\PyCharm 2016.1.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ImportError: DLL load failed: %1 is not a valid Win32 application.

Any idea what's wrong? Thank you!

It has to do with Qt DLL version conflicts. I was able to get it working by doing conda update --all

This seems to have fixed a missing dependancy: I see a copy of QtCore4.dll in C:\\Anaconda3\\Library\\bin and C:\\Anaconda3\\Library\\lib that weren't there before.

Based on the research below, other people copy QtCore4.dll, QtGui4.dll to C:\\Anaconda3\\Lib\\site-packages\\PyQt4\\bin, or they delete other path's from their environment

Here is some background:

Cannot import PyQt4.QtGui

iPython/jupyter qtconsole fails to start in anaconda 2.4.0

PyQt4 Need to move DLLs to package root

https://github.com/ContinuumIO/anaconda-issues/issues/540

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM