Bug 1502871 - Spyder - No module named 'matplotlib.backends.backend_qt4agg'
Summary: Spyder - No module named 'matplotlib.backends.backend_qt4agg'
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: spyder
Version: 26
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Mukundan Ragavan
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1506244 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-16 21:38 UTC by Shadders
Modified: 2018-05-29 11:57 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-05-29 11:57:01 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Test File for generating Error - Works Inline (283 bytes, text/plain)
2017-10-16 21:40 UTC, Shadders
no flags Details
Specifying Qt4Agg explicitly in matplotlib (176 bytes, text/x-python)
2017-10-27 09:24 UTC, jakob.jakobson18
no flags Details
Specifying Qt5Agg directly in matplotlib (176 bytes, text/x-python)
2017-10-27 09:25 UTC, jakob.jakobson18
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github spyder-ide spyder issues 5541 0 None None None 2017-10-22 20:17:58 UTC
Red Hat Bugzilla 1506244 0 unspecified CLOSED Problem with graphic backends in spyder 2021-02-22 00:41:40 UTC

Internal Links: 1506244

Description Shadders 2017-10-16 21:38:42 UTC
Description of problem:When the Spyder environment is set to graphical output as "auto" from Tool -> Preferences -> IPython Console -> Graphics tab - Backend selection [Automatic]


Version-Release number of selected component (if applicable):3.6.2


How reproducible:Always


Steps to Reproduce:
1.Tool -> Preferences -> IPython Console -> Graphics tab - Backend selection [Automatic]
 
2.Restart Spyder
3.Run script to plot a graphic
4. Receive the error.

Actual results:
runfile('/home/richard/DSP/SciPy/2017_10_16_Test_Plots.py', wdir='/home/richard/DSP/SciPy')
Traceback (most recent call last):

  File "<ipython-input-1-766045c41262>", line 1, in <module>
    runfile('/home/richard/DSP/SciPy/2017_10_16_Test_Plots.py', wdir='/home/richard/DSP/SciPy')

  File "/usr/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 707, in runfile
    execfile(filename, namespace)

  File "/usr/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 101, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/home/richard/DSP/SciPy/2017_10_16_Test_Plots.py", line 10, in <module>
    import matplotlib.pyplot as plt

  File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)

ModuleNotFoundError: No module named 'matplotlib.backends.backend_qt4agg'


Expected results: Graphic window should open.


Additional info: I have attempted to install multiple libraries and modify /etc/matplotlibrc to no avail. 

rpm -qa python3* | sort
python3-3.6.2-8.fc26.x86_64
python3-asn1crypto-0.22.0-4.fc26.noarch
python3-astroid-1.5.3-1.fc26.noarch
python3-augeas-0.5.0-8.fc26.noarch
python3-babel-2.3.4-5.fc26.noarch
python3-beaker-1.5.4-16.fc26.noarch
python3-beautifulsoup4-4.6.0-1.fc26.noarch
python3-bind-9.11.1-2.P3.fc26.noarch
python3-blivet-2.1.11-2.fc26.noarch
python3-blockdev-2.12-1.fc26.x86_64
python3-Bottleneck-1.2.1-1.fc26.x86_64
python3-brlapi-0.6.6-5.fc26.x86_64
python3-bytesize-0.11-1.fc26.x86_64
python3-cairo-1.10.0-20.fc26.x86_64
python3-caribou-0.4.21-3.fc26.noarch
python3-cffi-1.9.1-2.fc26.x86_64
python3-chardet-2.3.0-3.fc26.noarch
python3-coverage-4.4.1-1.fc26.x86_64
python3-cryptography-2.0.2-1.fc26.x86_64
python3-cssselect-0.9.2-4.fc26.noarch
python3-cups-1.9.72-11.fc26.x86_64
python3-cycler-0.10.0-3.fc26.noarch
python3-Cython-0.27.1-1.fc26.x86_64
python3-dateutil-2.6.0-3.fc26.noarch
python3-dbus-1.2.4-6.fc26.x86_64
python3-decorator-4.0.11-2.fc26.noarch
python3-devel-3.6.2-8.fc26.x86_64
python3-dmidecode-3.12.2-6.fc26.x86_64
python3-dnf-2.7.3-1.fc26.noarch
python3-dnf-plugins-core-2.1.5-1.fc26.noarch
python3-dnf-plugins-extras-common-2.0.3-1.fc26.noarch
python3-dnf-plugin-system-upgrade-2.0.3-1.fc26.noarch
python3-docutils-0.13.1-4.fc26.noarch
python3-enchant-1.6.10-1.fc26.noarch
python3-entrypoints-0.2.2-7.fc26.noarch
python3-fastcache-1.0.2-9.fc26.x86_64
python3-firewall-0.4.4.5-1.fc26.noarch
python3-funcsigs-1.0.2-5.fc26.noarch
python3-gmpy2-2.0.8-4.fc26.x86_64
python3-gobject-3.24.1-1.fc26.x86_64
python3-gobject-base-3.24.1-1.fc26.x86_64
python3-gpg-1.8.0-12.fc26.x86_64
python3-hawkey-0.11.0-1.fc26.x86_64
python3-html5lib-0.999-13.fc26.noarch
python3-humanize-0.5.1-7.fc26.noarch
python3-idna-2.5-1.fc26.noarch
python3-imagesize-0.7.1-5.fc26.noarch
python3-iniparse-0.4-24.fc26.noarch
python3-inotify-0.9.6-8.fc26.noarch
python3-ipykernel-4.6.0-1.fc26.noarch
python3-ipython-5.3.0-4.fc26.noarch
python3-ipython_genutils-0.1.0-9.fc26.noarch
python3-iscsi-initiator-utils-6.2.0.874-3.git86e8892.fc26.x86_64
python3-isort-4.2.5-7.fc26.noarch
python3-javapackages-4.7.0-17.fc26.noarch
python3-jedi-0.10.2-1.fc26.noarch
python3-jinja2-2.9.6-1.fc26.noarch
python3-jsonschema-2.5.1-5.fc26.noarch
python3-jupyter-client-4.4.0-3.fc26.noarch
python3-jupyter-core-4.1.0-8.fc26.noarch
python3-keyring-10.4.0-2.fc26.noarch
python3-kickstart-2.35-1.fc26.noarch
python3-lazy-object-proxy-1.3.1-1.fc26.x86_64
python3-libcomps-0.1.8-3.fc26.x86_64
python3-librepo-1.8.0-1.fc26.x86_64
python3-libs-3.6.2-8.fc26.x86_64
python3-libxml2-2.9.4-2.fc26.x86_64
python3-louis-2.6.2-9.fc26.noarch
python3-lxml-3.7.2-2.fc26.x86_64
python3-mako-1.0.6-3.fc26.noarch
python3-markupsafe-0.23-13.fc26.x86_64
python3-matplotlib-2.0.0-2.fc26.2.x86_64
python3-matplotlib-qt5-2.0.0-2.fc26.2.x86_64
python3-matplotlib-tk-2.0.0-2.fc26.2.x86_64
python3-mccabe-0.6.1-2.fc26.noarch
python3-meh-0.44-4.fc26.noarch
python3-meh-gui-0.44-4.fc26.noarch
python3-mistune-0.7.3-4.fc26.x86_64
python3-mock-2.0.0-4.fc26.noarch
python3-mpmath-0.19-8.fc26.noarch
python3-nbconvert-4.2.0-7.fc26.noarch
python3-nbformat-4.3.0-2.fc26.noarch
python3-notebook-5.0.0-1.fc26.noarch
python3-ntplib-0.3.3-6.fc26.noarch
python3-numexpr-2.6.1-5.fc26.x86_64
python3-numpy-1.12.1-1.fc26.x86_64
python3-numpydoc-0.7.0-1.fc26.noarch
python3-numpy-f2py-1.12.1-1.fc26.x86_64
python3-olefile-0.44-2.fc26.noarch
python3-ordered-set-2.0.0-6.fc26.noarch
python3-pandas-0.20.1-1.fc26.x86_64
python3-pandas-datareader-0.3.0-1.post0.fc26.noarch
python3-path-5.2-9.fc26.noarch
python3-pathlib2-2.1.0-3.fc26.noarch
python3-pbr-1.10.0-4.fc26.noarch
python3-pep8-1.6.2-8.fc26.noarch
python3-pexpect-4.2.1-1.fc26.noarch
python3-pickleshare-0.7.4-5.fc26.noarch
python3-pid-2.1.1-3.fc26.noarch
python3-pillow-4.1.1-1.fc26.x86_64
python3-pip-9.0.1-9.fc26.noarch
python3-ply-3.9-3.fc26.noarch
python3-prompt_toolkit-1.0.14-1.fc26.noarch
python3-psutil-5.0.1-2.fc26.x86_64
python3-ptyprocess-0.5.2-1.fc26.noarch
python3-pwquality-1.3.0-8.fc26.x86_64
python3-py-1.4.34-1.fc26.noarch
python3-pyasn1-0.2.3-1.fc26.noarch
python3-pyatspi-2.24.0-1.fc26.noarch
python3-pycodestyle-2.3.1-1.fc26.noarch
python3-pycparser-2.14-10.fc26.noarch
python3-pycurl-7.43.0-8.fc26.x86_64
python3-pydot-1.0.28-15.fc26.noarch
python3-pyflakes-1.5.0-2.fc26.noarch
python3-pyglet-1.2.4-3.fc26.noarch
python3-pygments-2.2.0-7.fc26.noarch
python3-pygpgme-0.3-22.fc26.x86_64
python3-pylint-1.7.2-2.fc26.noarch
python3-pyOpenSSL-16.2.0-6.fc26.noarch
python3-pyparsing-2.1.10-3.fc26.noarch
python3-pyparted-3.10.7-6.fc26.x86_64
python3-PyQt4-4.12-4.fc26.x86_64
python3-PyQt4-webkit-4.12-4.fc26.x86_64
python3-pysocks-1.6.7-1.fc26.noarch
python3-pytest-3.2.1-1.fc26.noarch
python3-pytest-runner-2.9-3.fc26.noarch
python3-pytz-2016.10-4.fc26.noarch
python3-pyudev-0.21.0-3.fc26.noarch
python3-pyxdg-0.25-12.fc26.noarch
python3-qt5-5.8.1-4.fc26.x86_64
python3-qt5-base-5.8.1-4.fc26.x86_64
python3-qt5-webkit-5.8.1-4.fc26.x86_64
python3-QtAwesome-0.4.4-1.fc26.noarch
python3-qtconsole-4.2.1-7.fc26.noarch
python3-QtPy-1.3.1-1.fc26.noarch
python3-requests-2.13.0-1.fc26.noarch
python3-requests-file-1.4-6.fc26.noarch
python3-requests-ftp-0.3.1-6.fc26.noarch
python3-rpm-4.13.0.1-7.fc26.x86_64
python3-rpm-macros-3-20.fc26.noarch
python3-scipy-0.19.1-1.fc26.x86_64
python3-SecretStorage-2.3.1-4.fc26.noarch
python3-setuptools-36.2.0-2.fc26.noarch
python3-simplegeneric-0.8.1-6.fc26.noarch
python3-sip-4.19.1-1.fc26.x86_64
python3-six-1.10.0-9.fc26.noarch
python3-slip-0.6.4-6.fc26.noarch
python3-slip-dbus-0.6.4-6.fc26.noarch
python3-snowballstemmer-1.2.1-3.fc26.noarch
python3-speechd-0.8.7-1.fc26.x86_64
python3-sphinx-1.5.2-4.fc26.noarch
python3-sphinx_rtd_theme-0.2.4-1.fc26.noarch
python3-sphinx-theme-alabaster-0.7.9-3.fc26.noarch
python3-spyder-3.2.2-1.fc26.noarch
python3-sssdconfig-1.15.3-4.fc26.noarch
python3-sympy-1.1.1-1.fc26.noarch
python3-systemd-234-1.fc26.x86_64
python3-tables-3.3.0-4.fc26.x86_64
python3-terminado-0.6-2.fc26.noarch
python3-theano-0.9.0-1.fc26.noarch
python3-tkinter-3.6.2-8.fc26.x86_64
python3-tornado-4.4.2-3.fc26.x86_64
python3-traitlets-4.3.2-2.fc26.noarch
python3-urllib3-1.20-1.fc26.noarch
python3-wcwidth-0.1.7-3.fc26.noarch
python3-wrapt-1.10.10-1.fc26.x86_64
python3-xlrd-1.0.0-6.fc26.noarch
python3-xlwt-1.1.2-2.fc26.noarch
python3-zmq-16.0.2-3.fc26.x86_64
 
All configuration files have been returned to previous state - and still the same issue. Multiple searches on google and modification undertaken - library install - still no resolution.

Comment 1 Shadders 2017-10-16 21:40:39 UTC
Created attachment 1339477 [details]
Test File for generating Error - Works Inline

Test file for generating the error - inline works, automatic graphic setting fails.

Comment 2 Shadders 2017-10-16 21:43:46 UTC
Apologies, should have stated - the graphics work for the inline setting. 

I examined bug https://bugzilla.redhat.com/show_bug.cgi?id=1494682 and this has not resolved.

Comment 3 Mukundan Ragavan 2017-10-21 15:27:07 UTC
I can reliably reproduce this on my end. If I set the backend to tk or gtk3, plot appears without problems.

If it's set to automatic, I get a similar error. I do not understand why yours needs qt4agg though.


 Traceback (most recent call last):

  File "<ipython-input-1-64557277dbff>", line 1, in <module>
    get_ipython().run_line_magic('matplotlib', 'qt5')

  File "/usr/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2095, in run_line_magic
    result = fn(*args,**kwargs)

  File "<decorator-gen-107>", line 2, in matplotlib

  File "/usr/lib/python3.6/site-packages/IPython/core/magic.py", line 187, in <lambda>
    call = lambda f, *a, **k: f(*a, **k)

  File "/usr/lib/python3.6/site-packages/IPython/core/magics/pylab.py", line 99, in matplotlib
    gui, backend = self.shell.enable_matplotlib(args.gui)

  File "/usr/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2978, in enable_matplotlib
    pt.activate_matplotlib(backend)

  File "/usr/lib/python3.6/site-packages/IPython/core/pylabtools.py", line 307, in activate_matplotlib
    import matplotlib.pyplot

  File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)

ModuleNotFoundError: No module named 'matplotlib.backends.backend_qt5agg'



Can you file this upstream or do you want me to?

Comment 4 Shadders 2017-10-21 15:51:10 UTC
Hi Mukudan,

Can you file this upstream, as i am not sure how to progress that aspect. 

Thanks and regards,
Shadders.

Comment 5 Mukundan Ragavan 2017-10-22 20:17:58 UTC
Filed upstream report.

Comment 6 Mukundan Ragavan 2017-10-22 23:09:16 UTC
Shadders, can you try some stuff for me here?

Install python3-spyder, python3-matplotlib-qt5.

Line 38 in /etc/matplotlibrc should be 

"backend     : Qt5Agg"


Now, set the backend to automatic in spyder and try it.

You have mentioned that you tried editing /etc/matplotlibrc but I am not sure what is going on here.

I realized (only now, sorry!) that backend was set to TkAgg in /etc/matplotlibrc. After I change that, 'automatic' works for me.

Comment 7 jakob.jakobson18 2017-10-24 18:23:05 UTC
Hi Mukundan,

after I crashed Spyder by selecting the automatic graphic backend once I don't get it to start no more.

Here is how the reproduce the crash: Take a fresh installation, start spyder3, crash it by selecting the wrong graphics backend. Try to restart spyder3 and take a look at the following error message:

$ spyder3
Traceback (most recent call last):
  File "/usr/bin/spyder3", line 3, in <module>
    start.main()
  File "/usr/lib/python3.6/site-packages/spyder/app/start.py", line 140, in main
    from spyder.app import mainwindow
  File "/usr/lib/python3.6/site-packages/spyder/app/mainwindow.py", line 92, in <module>
    from qtpy import QtWebEngineWidgets  # analysis:ignore
  File "/usr/lib/python3.6/site-packages/qtpy/QtWebEngineWidgets.py", line 43, in <module>
    from PyQt4.QtWebKit import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt4.QtWebKit'



I tried to to delete the

~/.config/spyder-py3
~/.config/matplotlib

folders and restart Spyder but that does not make any difference. Is this related to the previous descriptions in this bug? I should mention that also in a python3 console you can't import QWebPage from PyQt4.WebKit

$python3
>>> from PyQt4.QtWebKit import QWebPage as QWebEnginePage
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt4.QtWebKit'

even though pyqt4-webkit is installed.

$ dnf list pyqt4*
Installed packages
PyQt4.x86_64                             4.12-4.fc26                    @updates
PyQt4-doc.noarch                         4.12-4.fc26                    @updates
PyQt4-webkit.x86_64                      4.12-4.fc26                    @updates


Regards

Comment 8 jakob.jakobson18 2017-10-24 19:18:05 UTC
(In reply to Jakob Jakobson from comment #7)

> Hi Mukundan,
> 
> after I crashed Spyder by selecting the automatic graphic backend once I
> don't get it to start no more.
> Here is how the reproduce the crash: Take a fresh installation, start
> spyder3, crash it by selecting the wrong graphics backend. Try to restart
> spyder3 and take a look at the following error message:

That description is not exactly right. I can't reproduce the error (so I don't know if the automatic backend was the cause but it has to be related to the graphics backend) even though it happened.

Comment 9 Mukundan Ragavan 2017-10-24 21:48:26 UTC
Can you try launching spyder using after doing this?

spyder3 --reset

This will reset ALL your configuration files.

I will investigate other issues (perhaps move it to a new bug if needed).

Comment 10 Mukundan Ragavan 2017-10-24 21:58:34 UTC
(In reply to Jakob Jakobson from comment #7)
> $python3
> >>> from PyQt4.QtWebKit import QWebPage as QWebEnginePage
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ModuleNotFoundError: No module named 'PyQt4.QtWebKit'
> 
> even though pyqt4-webkit is installed.
> 
> $ dnf list pyqt4*
> Installed packages
> PyQt4.x86_64                             4.12-4.fc26                   
> @updates
> PyQt4-doc.noarch                         4.12-4.fc26                   
> @updates
> PyQt4-webkit.x86_64                      4.12-4.fc26                   
> @updates
> 
> 
> Regards

Well, this is working correctly. If you are using python3, you need to install python3-PyQt4-Webkit.

Comment 11 Shadders 2017-10-24 22:06:52 UTC
Hi,

I implemented the reset command, changed to "automatic", restarted spyder3, ran the file and the same error. 

python3-PyQt4-Webkit is already installed. 

Regards,
Shadders.

Comment 12 Mukundan Ragavan 2017-10-24 22:47:29 UTC
Would you be willing to add some info here?

This is starting to move beyond my troubleshooting skills ... 

https://github.com/spyder-ide/spyder/issues/5541




As for webkit import, I cannot reproduce that either inside spyder or in a separate python3 shell.

Comment 13 Shadders 2017-10-26 16:54:41 UTC
Hi Mukundan,

--------------------------------
The latest from github :

 ccordoba12 commented 2 hours ago

    The matplotlibrc file is located in the /etc directory

So, this is a problem with Fedora setting a default backend in its Matplotlib package. There's nothing we can do about it, except catching the errors above to prevent these crashes.
--------------------------------
I checked my paths

~/.config/spyder-py3
~/.config/matplotlib

And there is nothing in the matplotlib directory.

For further investigation, if someone could state which file gets changed when selecting "automatic" i can then check if it is completing the change.

Thanks and regards,
Shadders.

Comment 14 jakob.jakobson18 2017-10-26 17:27:15 UTC
> --------------------------------
> The latest from github :
> 
>  ccordoba12 commented 2 hours ago
> 
>     The matplotlibrc file is located in the /etc directory
> 
> So, this is a problem with Fedora setting a default backend in its Matplotlib > package. There's nothing we can do about it, except catching the errors above > to prevent these crashes.
> --------------------------------

I don't find a matplotlibrc file in the matplotlib github repository (as an "official" reference), 
If you compare the matplotlibrc file shipped by Fedora with the matplotlibrc from its GitHup repository
The only interesting difference in these files that I can find is

< backend      : $TEMPLATE_BACKEND (Matplotlib's matplotlibrc.template file)
---
> backend      : TkAgg (Fedora's /etc/matplotlibrc file)

and Fedora, Debian and Ubuntu choose the TkAgg backend. So the TkAgg choice doesn't seem to be a Fedora specific one.



>
> For further investigation, if someone could state which file gets changed
> when selecting "automatic" i can then check if it is completing the change.
> 

The user's configuration of Spyder3 seems to be saved in 

~/.config/spyder-py3/spyder.ini

and the interesting lines seem to be 

[ipython_console]
... (skipping lines)
pylab/backend = 0

pylab/backend = 0 equals internal
pylab/backend = 1 equals automatic
up to
pylab/backend = 8 equals tkinter

Comment 15 Shadders 2017-10-26 18:44:17 UTC
Hi Jakob,

Thanks - i have checked and the setting is equal to 1, so "automatic" has been set. Permissions are ok too. 

Regards,
Shadders.

Comment 16 Mukundan Ragavan 2017-10-26 19:27:56 UTC
Not to mention, pt plot window is the only one that shows up weird (without showing the plot) ...

Comment 17 Shadders 2017-10-26 20:22:14 UTC
Hi,
I have solved the issue - i needed to install :

python3-matplotlib-qt4 

Once this has been installed and spyder3 restarted (automatic) then the following error is received :

[lots of text not show]
  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/qt_compat.py", line 127, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets

RuntimeError: the PyQt5.QtCore and PyQt4.QtCore modules both wrap the QObject class

If yourself and Jakob can reproduce - after adding the python3-matplotlib-qt4, then i asume we can close - and i will investigate the issue with regards to the error above. 

Regards,
Shadders.

Comment 18 jakob.jakobson18 2017-10-26 22:06:02 UTC
Hi Shadders,

Well, replacing one error by another doesn't really seem as a solution.
But I can reproduce the error message produced by the automatic backend posted by you. To be complete below is the complete error message:

In [1]: import matplotlib.pyplot as plt
Traceback (most recent call last):

  File "<ipython-input-1-eff513f636fd>", line 1, in <module>
    import matplotlib.pyplot as plt

  File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/backend_qt4agg.py", line 18, in <module>
    from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/backend_qt5.py", line 26, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 20, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/qt_editor/formlayout.py", line 56, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/qt_compat.py", line 127, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets

RuntimeError: the PyQt5.QtCore and PyQt4.QtCore modules both wrap the QObject class



And for the completeness a list the installed packages.

PyQt4.x86_64                             4.12-4.fc26              @updates
PyQt4-webkit.x86_64                      4.12-4.fc26              @updates
python3-PyQt4.x86_64                     4.12-4.fc26              @updates
python3-PyQt4-webkit.x86_64              4.12-4.fc26              @updates

python3-qt5.x86_64                         5.8.1-4.fc26           @updates
python3-qt5-base.x86_64                    5.8.1-4.fc26           @updates
python3-qt5-webkit.x86_64                  5.8.1-4.fc26           @updates
python3-qtconsole.noarch                   4.2.1-7.fc26           @fedora 

python3-QtPy.noarch                 1.3.1-1.fc26                  @updates

python3-matplotlib.x86_64                2.0.0-2.fc26.2            @fedora
python3-matplotlib-gtk3.x86_64           2.0.0-2.fc26.2            @fedora
python3-matplotlib-qt4.x86_64            2.0.0-2.fc26.2            @fedora
python3-matplotlib-qt5.x86_64            2.0.0-2.fc26.2            @fedora
python3-matplotlib-tk.x86_64             2.0.0-2.fc26.2            @fedora


But to me this bug seems to get out of hand as now also PyQt packages seem to be considered.


Regards

Comment 19 Mukundan Ragavan 2017-10-26 22:15:43 UTC
*** Bug 1506244 has been marked as a duplicate of this bug. ***

Comment 20 Mukundan Ragavan 2017-10-26 22:19:45 UTC
The problem is that installing python3-matplotlib-qt4 also bring -qt5 version of the package.


# inpkg python3-matplotlib-qt4
Last metadata expiration check: 0:23:02 ago on Thu 26 Oct 2017 05:55:04 PM EDT.
Dependencies resolved.
================================================================================
 Package                      Arch       Version               Repository  Size
================================================================================
Installing:
 python3-matplotlib-qt4       x86_64     2.0.0-3.fc27          fedora      29 k
Installing dependencies:
 kde-filesystem               x86_64     4-57.fc27             fedora      50 k
 phonon                       x86_64     4.9.1-5.fc27          fedora     213 k
 phonon-backend-gstreamer     x86_64     2:4.9.0-4.fc27        fedora     152 k
 python3-PyQt4                x86_64     4.12.1-4.fc27         fedora     2.9 M
 python3-matplotlib-qt5       x86_64     2.0.0-3.fc27          fedora      47 k

Transaction Summary
================================================================================
Install  6 Packages

Total download size: 3.4 M
Installed size: 16 M
Is this ok [y/N]: 

I think this is now beyond spyder, honestly. I suggest opening a bug report, possibly against matplotlib or PyQt{4,5}. Perhaps, that would be more useful. Sorry.

Comment 21 jakob.jakobson18 2017-10-27 09:24:51 UTC
Created attachment 1344229 [details]
Specifying Qt4Agg explicitly in matplotlib

Comment 22 jakob.jakobson18 2017-10-27 09:25:20 UTC
Created attachment 1344230 [details]
Specifying Qt5Agg directly in matplotlib

Comment 23 jakob.jakobson18 2017-10-27 09:32:31 UTC
To make things worse I got one more question: If the backend is broken, should it also throw an error message if I run my files directly by
$python3 matplotlib_script.py ? If it should throw an error continue reading, if it shouldn't throw an error dismiss the rest of the post.

So coming back to your comment:

> I think this is now beyond spyder, honestly. I suggest opening a bug report,
> possibly against matplotlib or PyQt{4,5}. Perhaps, that would be more
> useful. Sorry.

Is my previous assumption about the backend right or wrong? My test files (Qt4Agg.py and Qt5Agg.py) are doing fine if I call them directly with python3.
So my less educated guess would be that the backends per se work as they should but Spyder3 has some bug/missing dependency/something else in its import routine.


Regards

Comment 24 Shadders 2017-10-27 09:34:24 UTC
Hi Jakob,

I have tried this yesterday - fails to work on my installation. 

Still get the error :

 File "/usr/lib64/python3.6/site-packages/matplotlib/backends/qt_compat.py", line 127, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets

RuntimeError: the PyQt5.QtCore and PyQt4.QtCore modules both wrap the QObject class

Regards,
Shadders.

Comment 25 Shadders 2017-10-27 09:38:25 UTC
Hi Jakob,

Thanks - i ran the script from the command line, and the plot is presented, so it is a Spyder installation issue ?

Thanks and regards,
Shadders.

Comment 26 Mukundan Ragavan 2017-10-27 09:47:23 UTC
(In reply to Jakob Jakobson from comment #23)
> 
> Is my previous assumption about the backend right or wrong? My test files
> (Qt4Agg.py and Qt5Agg.py) are doing fine if I call them directly with
> python3.
> So my less educated guess would be that the backends per se work as they
> should but Spyder3 has some bug/missing dependency/something else in its
> import routine.
> 

Yup. I can run this too. $python3 qt4agg.py and $python3 qt5agg.py both work.

Furthermore, if I deactivate graphics support (Tools --> Preferences --> Ipython console --> Graphics tab --> uncheck graphics support)for ipython in spyder, it works.

Let me see if I can find what is being imported.

Comment 27 Shadders 2017-10-27 20:22:09 UTC
Hi Mukundan,

Thanks for progressing - yes, this works for me also. 

Regards,
Shadders.

Comment 28 Shadders 2017-10-27 20:32:57 UTC
Hi All,

As an update, if you run Jakob's Qt5Agg.py example, it works. If you then close the graphic and run again, the console in Spyder3 hangs and no graphic is displayed. 

Pressing CTRL+C causes the kernel to die and then restart. 

Regards,
Shadders.

Comment 29 jakob.jakobson18 2017-11-10 10:36:01 UTC
(In reply to Mukundan Ragavan from comment #12)
> Would you be willing to add some info here?
> 
> This is starting to move beyond my troubleshooting skills ... 
> 
> https://github.com/spyder-ide/spyder/issues/5541
> 
> 
> 
> 
> As for webkit import, I cannot reproduce that either inside spyder or in a
> separate python3 shell.

As this bug opens a lot of other questions that don't seem to be very simple to answer, there is a (well not very elegant, but useful) workaround:
Activate the an external system terminal via

Preferences -> Run -> Console: "Execute in an external system terminal"

This opens each time an external python3 console you plot something but at least it works.

Comment 30 jakob.jakobson18 2017-11-15 19:25:03 UTC
Can you take at look at this pull request in the spyder repository:

https://github.com/spyder-ide/spyder/pull/5758

It is supposed to help fixing our problems here.

Comment 31 Mukundan Ragavan 2017-11-15 19:47:27 UTC
Thanks! I will build this later today as a test package and post the link here.

Comment 32 Mukundan Ragavan 2017-11-17 03:14:56 UTC
hmmm ..the patch is a little more complicated than I thought. I will try to do this over the next few days.

Comment 33 Mukundan Ragavan 2017-11-17 19:29:13 UTC
I am following that github issue. I will wait for some more testing and feedback from you.

Thanks!

Comment 34 Mukundan Ragavan 2018-03-03 22:45:12 UTC
I trust this was fixed with 3.2.5.

Can you check?

Comment 35 Fedora End Of Life 2018-05-03 08:14:24 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 36 Fedora End Of Life 2018-05-29 11:57:01 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.