Skip to content

Import Error on matplotlib.pyplot: PyQt4 #7125

Closed
@lheagy

Description

@lheagy

import matplotlib.pyplot as plt is erroring for matplotlib-1.5.3 while trying to import from PyQt4.

I have observed this while running on Travis-CI, linux, installing matplotlib using conda. Here is a trace-back from the python 3.4.2 failure (https://travis-ci.org/simpeg/simpeg/jobs/160737799), for 2.7.9, there is an example in the travis log: https://travis-ci.org/simpeg/simpeg/jobs/160737812)

import matplotlib.pyplot as plt
  File "/home/travis/miniconda/lib/python3.4/site-packages/matplotlib/pyplot.py", line 114, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/home/travis/miniconda/lib/python3.4/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/home/travis/miniconda/lib/python3.4/site-packages/matplotlib/backends/backend_qt4agg.py", line 18, in <module>
    from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase
  File "/home/travis/miniconda/lib/python3.4/site-packages/matplotlib/backends/backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore
  File "/home/travis/miniconda/lib/python3.4/site-packages/matplotlib/backends/backend_qt5.py", line 31, in <module>
    from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
  File "/home/travis/miniconda/lib/python3.4/site-packages/matplotlib/backends/qt_compat.py", line 137, in <module>
    from PyQt4 import QtCore, QtGui
ImportError: No module named 'PyQt4'

The environment is

    package                    |            build
    ---------------------------|-----------------
    expat-2.1.0                |                0         365 KB
    icu-54.1                   |                0        11.3 MB
    jpeg-8d                    |                1         806 KB
    libffi-3.2.1               |                0          36 KB
    libgcc-5.2.0               |                0         1.1 MB
    libgfortran-3.0.0          |                1         281 KB
    libxcb-1.12                |                0         1.5 MB
    mkl-11.3.3                 |                0       122.1 MB
    dbus-1.10.10               |                0         2.4 MB
    glib-2.43.0                |                1         5.4 MB
    libpng-1.6.22              |                0         214 KB
    libxml2-2.9.2              |                0         4.2 MB
    alabaster-0.7.9            |           py34_0          11 KB
    cython-0.24.1              |           py34_0         6.3 MB
    decorator-4.0.10           |           py34_0          12 KB
    docutils-0.12              |           py34_2         673 KB
    freetype-2.5.5             |                1         2.5 MB
    gstreamer-1.8.0            |                0         2.6 MB
    imagesize-0.7.1            |           py34_0           3 KB
    ipython_genutils-0.1.0     |           py34_0          33 KB
    markupsafe-0.23            |           py34_2          32 KB
    mpmath-0.19                |           py34_1         901 KB
    nose-1.3.7                 |           py34_1         196 KB
    numpy-1.11.1               |           py34_0         6.1 MB
    path.py-8.2.1              |           py34_0          47 KB
    ptyprocess-0.5.1           |           py34_0          19 KB
    pygments-2.1.3             |           py34_0         1.2 MB
    pyparsing-2.1.4            |           py34_0          72 KB
    pytz-2016.6.1              |           py34_0         177 KB
    pyyaml-3.12                |           py34_0         348 KB
    setuptools-27.2.0          |           py34_0         528 KB
    simplegeneric-0.8.1        |           py34_1           7 KB
    sip-4.18                   |           py34_0         240 KB
    six-1.10.0                 |           py34_0          17 KB
    snowballstemmer-1.2.1      |           py34_0          79 KB
    sphinx_rtd_theme-0.1.9     |           py34_0         628 KB
    wcwidth-0.1.7              |           py34_0          21 KB
    wheel-0.29.0               |           py34_0          82 KB
    babel-2.3.4                |           py34_0         4.8 MB
    cycler-0.10.0              |           py34_0          11 KB
    fontconfig-2.11.1          |                6         405 KB
    gst-plugins-base-1.8.0     |                0         3.1 MB
    jinja2-2.8                 |           py34_1         304 KB
    pexpect-4.0.1              |           py34_0          66 KB
    pickleshare-0.7.4          |           py34_0           9 KB
    pip-8.1.2                  |           py34_0         1.6 MB
    prompt_toolkit-1.0.3       |           py34_0         309 KB
    python-dateutil-2.5.3      |           py34_0         238 KB
    scipy-0.18.0               |      np111py34_0        30.7 MB
    sympy-1.0                  |           py34_0         5.9 MB
    traitlets-4.3.0            |           py34_0         125 KB
    ipython-5.1.0              |           py34_0         994 KB
    qt-5.6.0                   |                0        43.9 MB
    sphinx-1.4.1               |           py34_0         1.3 MB
    pyqt-5.6.0                 |           py34_0         5.2 MB
    matplotlib-1.5.3           |      np111py34_0         8.4 MB
    ------------------------------------------------------------
                                           Total:       279.6 MB

This was not an issue when using matplotlib-1.5.1 and pyqt-4.11.4 (https://travis-ci.org/simpeg/simpeg/jobs/159897876#L379)

Thanks for your help!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions