No module named PyQt4 in python 3.6 when I use matplotlib.pyplot
For python 3.6(since i had that in my computer), you go to command line , and type this :
conda install -c anaconda pyqt=5.6.0
If you are unsure about the python and pyqt version. Then type :
conda info pyqt
This will output the relevant pyqt version. Hence you can check your pyqt version and install from command mentioned at first.
When I import matplotlib.pyplot in any python 3.6 program, I get the following error:
$ python kernel1.py
Traceback (most recent call last):
  File "kernel1.py", line 13, in <module>
    import matplotlib.pyplot as plt
  File "/home/atul/anaconda3/lib/python3.6/site-packages/matplotlib/pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/home/atul/anaconda3/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/home/atul/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore
  File "/home/atul/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_qt5.py", line 26, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "/home/atul/anaconda3/lib/python3.6/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 20, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout
  File "/home/atul/anaconda3/lib/python3.6/site-packages/matplotlib/backends/qt_editor/formlayout.py", line 56, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
  File "/home/atul/anaconda3/lib/python3.6/site-packages/matplotlib/backends/qt_compat.py", line 137, in <module>
    from PyQt4 import QtCore, QtGui
ModuleNotFoundError: No module named 'PyQt4'
However, if I use python 3.5, matplotlib.pyplot works perfectly. 
I have tried using sudo apt-get install python-qt4. Still I get the same error.
I am using Ubuntu 16.04.