ImportError: cannot import name 'QtCore'
<p>I am getting the below error with the following imports.
It seems to be related to pandas import. I am unsure how to debug/solve this.</p>

<p>Imports:</p>

<pre><code>import pandas as pd
import numpy as np
import pdb, math, pickle
import matplotlib.pyplot as plt
</code></pre>

<p>Error:</p>

<pre><code>In [1]: %run NN.py
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/home/abhishek/Desktop/submission/a1/new/NN.py in &lt;module&gt;()
      2 import numpy as np
      3 import pdb, math, pickle
----&gt; 4 import matplotlib.pyplot as plt
      5 
      6 class NN(object):

/home/abhishek/anaconda3/lib/python3.5/site-packages/matplotlib/pyplot.py in &lt;module&gt;()
    112 
    113 from matplotlib.backends import pylab_setup
--&gt; 114 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
    115 
    116 _IP_REGISTERED = None

/home/abhishek/anaconda3/lib/python3.5/site-packages/matplotlib/backends/__init__.py in pylab_setup()
     30     # imports. 0 means only perform absolute imports.
     31     backend_mod = __import__(backend_name,
---&gt; 32                              globals(),locals(),[backend_name],0)
     33 
     34     # Things we pull in from all backends

/home/abhishek/anaconda3/lib/python3.5/site-packages/matplotlib/backends/backend_qt4agg.py in &lt;module&gt;()
     16 
     17 
---&gt; 18 from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase
     19 
     20 from .backend_agg import FigureCanvasAgg

/home/abhishek/anaconda3/lib/python3.5/site-packages/matplotlib/backends/backend_qt5agg.py in &lt;module&gt;()
     14 
     15 from .backend_agg import FigureCanvasAgg
---&gt; 16 from .backend_qt5 import QtCore
     17 from .backend_qt5 import QtGui
     18 from .backend_qt5 import FigureManagerQT

/home/abhishek/anaconda3/lib/python3.5/site-packages/matplotlib/backends/backend_qt5.py in &lt;module&gt;()
     29     figureoptions = None
     30 
---&gt; 31 from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
     32 from matplotlib.backends.qt_editor.formsubplottool import UiSubplotTool
     33 

/home/abhishek/anaconda3/lib/python3.5/site-packages/matplotlib/backends/qt_compat.py in &lt;module&gt;()
    135     # have been changed in the above if block
    136     if QT_API in [QT_API_PYQT, QT_API_PYQTv2]:  # PyQt4 API
--&gt; 137         from PyQt4 import QtCore, QtGui
    138 
    139         try:

ImportError: cannot import name 'QtCore'
</code></pre>

<p>Debugging:</p>

<pre><code>$ python -c "import PyQt4"
$ python -c "from PyQt4 import QtCore"
Traceback (most recent call last):
  File "&lt;string&gt;", line 1, in &lt;module&gt;
ImportError: cannot import name 'QtCore'
$ conda list | grep qt
jupyter-qtconsole-colorschemes 0.7.1                     &lt;pip&gt;
pyqt                      5.6.0                    py35_0  
qt                        5.6.0                         0  
qtawesome                 0.3.3                    py35_0  
qtconsole                 4.2.1                    py35_0  
qtpy                      1.0.2                    py35_0 
</code></pre>

<p>I found other answers but all related to Windows. 
I am using ubuntu 16.04 with anaconda distribution of python 3.</p>

<p>Updating matplotlib did the trick for me: </p>

<pre><code>conda install matplotlib
</code></pre>

python anaconda python-import qtcore