Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Improve how Matplotlib backend is set in the IPython console #5758

Merged
merged 6 commits into from
Nov 27, 2017

Conversation

ccordoba12
Copy link
Member

@ccordoba12 ccordoba12 commented Nov 15, 2017

Fixes #5718
Fixes #5541

…ails for whatever reason

Also simplify how we show errors caused by this.
@ccordoba12 ccordoba12 added this to the v3.2.5 milestone Nov 15, 2017
@ghost
Copy link

ghost commented Nov 15, 2017

I tested your pull request (* Spyder Version: 3.2.5.dev0 afeb581) and at startup of spyder I get the following message:

Python 3.6.2 (default, Sep  1 2017, 12:03:48)
Type "copyright", "credits" or "license" for more information.

IPython 6.2.1 -- An enhanced Interactive Python.

NOTE: The following error appeared when setting your Matplotlib backend

Traceback (most recent call last):
  File "/home/ich/Kram/spyder/spyder/utils/ipython/spyder_kernel.py", line 439, in _set_mpl_backend
    get_ipython().run_line_magic('matplotlib', backend)
  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 2983, in enable_matplotlib
    self.enable_gui(gui)
  File "/usr/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 482, in enable_gui
    real_enable_gui(gui)
  File "/usr/lib/python3.6/site-packages/ipykernel/eventloops.py", line 284, in enable_gui
    raise RuntimeError("Cannot activate multiple GUI eventloops")
RuntimeError: Cannot activate multiple GUI eventloops

After that error I can use the IPython console but the attempt to plot still results in an empty canvas that does not react on mouse clicks.

@ccordoba12
Copy link
Member Author

Right, this means things are working as expected. I mean, at least we are able to catch that error and show it to users.

This means you need to deactivate the Activate support option in

Preferences > IPython console > Graphics

so that Matplotlib sets its backend by itself (i.e. without Spyder interference). That should fix your problem.

Could you verify it? Thanks!

@ghost
Copy link

ghost commented Nov 16, 2017

If the Activate support is deactivated and matplotlib sets its backend by itself the plotting works. But under these conditions the plotting worked also before your pull request I have to admit.

Two comments on your pull request:

  • If I choose any other backend than TkAgg Spyder shows me the following message
Python 3.6.2 (default, Sep  1 2017, 12:03:48)
Type "copyright", "credits" or "license" for more information.

IPython 6.2.1 -- An enhanced Interactive Python.

NOTE: Spyder *can't* set your selected Matplotlib backend because there is an external matplotlibrc file that's setting it first.

This file could be located at '/etc/matplotlibrc'.

Your backend will be TkAgg
  • The installed backends have an influence on the plotting/importing of matplotlib in Spyder. But I will discuss that with the Fedora mantainers.

@ccordoba12
Copy link
Member Author

If the Activate support is deactivated and matplotlib sets its backend by itself the plotting works. But under these conditions the plotting worked also before your pull request I have to admit.

Yeah, that's right. But after this PR we will be able to tell users that they need to deactivate our Graphics support, so that Matplotlib can do its job without us interfering on it.

For that, I'll catch the RuntimeError you posted and print a new message saying that instead.

If I choose any other backend than TkAgg Spyder shows me the following message

That's part of this PR and just informs users that Spyder can't set a new backend if there's one in matplotlibrc. It's simply impossible because of the way Matplotlib is designed, and that was what I rant about on issue #5541.

The installed backends have an influence on the plotting/importing of matplotlib in Spyder. But I will discuss that with the Fedora mantainers.

I think it's not exactly that, it's the fact that there's a default backend in /etc/matplotlibrc.

Could you comment the backend line in your /etc/matplotlibrc and see if Spyder can set your backend without problems?

@ghost
Copy link

ghost commented Nov 17, 2017

Well there is a short and a long answer.

Short answer

Could you comment the backend line in your /etc/matplotlibrc and see if Spyder can set your backend without problems?

The short answer is: yes, Spyder can set the backend but you obviously have set the interactive backend manually if you call matplotlib outside of spyder. The long answer follows at the bottom.

Given the scenario you write your plotting script in spyder and you commented your backend in /etc/matplotlibrc , you either don't set the graphics backend (as spyder does it for you) in your plotting script or you choose the one spyder uses (as otherwise you will run into problems). If you now switch to python3 console without the spyder context you have to insert the line matplotlib.use("XY") into your script. What would possibly break you compatibility if you switch to the spyder IDE again.
So I wouldn't take it as the most elegant solution to adapt your python scripts to each interpreter/IDE.

Long answer

The installed backends have an influence on the plotting/importing of matplotlib in Spyder. But I will discuss that with the Fedora mantainers.

I think it's not exactly that, it's the fact that there's a default backend in /etc/matplotlibrc.

Well, I think we have a bit of a misunderstanding here as I meant some different behaviour of Spyder. I have two test cases:

Test case A

I commented the TkAgg backend in /etc/matplotlibrc and have the following backends installed:

$ dnf list *matplotlib*
python-matplotlib-data.noarch                   2.0.0-3.fc27             @fedora
python-matplotlib-data-fonts.noarch             2.0.0-3.fc27             @fedora
python2-matplotlib.x86_64                       2.0.0-3.fc27             @fedora
python2-matplotlib-doc.x86_64                   2.0.0-3.fc27             @fedora
python2-matplotlib-tk.x86_64                    2.0.0-3.fc27             @fedora
python3-matplotlib.x86_64                       2.0.0-3.fc27             @fedora
python3-matplotlib-gtk3.x86_64                  2.0.0-3.fc27             @fedora
python3-matplotlib-tk.x86_64                    2.0.0-3.fc27             @fedora

Testing only the different installed backends gives the following results:

  • Inline: works
  • GTK3: works
  • TkInter: works

Test case B

I commented the TkAgg backend in /etc/matplotlibrc and have the following backends installed:

$dnf list *matplotlib*
python-matplotlib-data.noarch                   2.0.0-3.fc27             @fedora
python-matplotlib-data-fonts.noarch             2.0.0-3.fc27             @fedora
python3-matplotlib.x86_64                       2.0.0-3.fc27             @fedora
python3-matplotlib-gtk3.x86_64                  2.0.0-3.fc27             @fedora
python3-matplotlib-qt4.x86_64                   2.0.0-3.fc27             @fedora
python3-matplotlib-qt5.x86_64                   2.0.0-3.fc27             @fedora
python3-matplotlib-tk.x86_64                    2.0.0-3.fc27             @fedora

Testing only the different installed backends gives the following results:

  • Inline: works
  • Automatic:
Python 3.6.2 (default, Sep  1 2017, 12:03:48)
Type "copyright", "credits" or "license" for more information.

IPython 6.2.1 -- An enhanced Interactive Python.

NOTE: The following error appeared when setting your Matplotlib backend

Traceback (most recent call last):
  File "/home/ich/Kram/spyder/spyder/utils/ipython/spyder_kernel.py", line 439, in _set_mpl_backend
    get_ipython().run_line_magic('matplotlib', backend)
  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)
  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


In [1]: 
  • Qt5:
Python 3.6.2 (default, Sep  1 2017, 12:03:48)
Type "copyright", "credits" or "license" for more information.

IPython 6.2.1 -- An enhanced Interactive Python.

NOTE: The following error appeared when setting your Matplotlib backend

Traceback (most recent call last):
  File "/home/ich/Kram/spyder/spyder/utils/ipython/spyder_kernel.py", line 439, in _set_mpl_backend
    get_ipython().run_line_magic('matplotlib', backend)
  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 2983, in enable_matplotlib
    self.enable_gui(gui)
  File "/usr/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 482, in enable_gui
    real_enable_gui(gui)
  File "/usr/lib/python3.6/site-packages/ipykernel/eventloops.py", line 284, in enable_gui
    raise RuntimeError("Cannot activate multiple GUI eventloops")
RuntimeError: Cannot activate multiple GUI eventloops


In [1]: 
  • QT4: Shows no graphic windows. (As running the plot files does nothing?)
In [1]: runfile('/home/ich/.config/spyder-py3/temp.py', wdir='/home/ich/.config/spyder-py3')

In [2]: 
  • Gtk3: It takes forever to connect to the IPython console, actually I never made it that far.
  • TkInter:
Python 3.6.2 (default, Sep  1 2017, 12:03:48)
Type "copyright", "credits" or "license" for more information.

IPython 6.2.1 -- An enhanced Interactive Python.

NOTE: The following error appeared when setting your Matplotlib backend

Traceback (most recent call last):
  File "/home/ich/Kram/spyder/spyder/utils/ipython/spyder_kernel.py", line 439, in _set_mpl_backend
    get_ipython().run_line_magic('matplotlib', backend)
  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 2983, in enable_matplotlib
    self.enable_gui(gui)
  File "/usr/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 482, in enable_gui
    real_enable_gui(gui)
  File "/usr/lib/python3.6/site-packages/ipykernel/eventloops.py", line 284, in enable_gui
    raise RuntimeError("Cannot activate multiple GUI eventloops")
RuntimeError: Cannot activate multiple GUI eventloops


In [1]

So what I meant was that the behaviour of Gtk3 and Tkinter differ from test case A to test case B even though only the number of installed backends (and the included dependencies) is different in the two cases.
But from my point of view backend X shouldn't interfere with backend Y and that is what I meant when I said:

The installed backends have an influence on the plotting/importing of matplotlib in Spyder. But I will discuss that with the Fedora mantainers.

Regards

@bcolsen
Copy link
Member

bcolsen commented Nov 18, 2017

I didn't fully look into this but it seem it might be useful here:

matplotlib/matplotlib#9795

@ccordoba12
Copy link
Member Author

@JakobJakobson, I think the problem is that you have both the PyQt4 and PyQt5 backends installed and you're using Spyder with PyQt4 (at least that's what you reported on issue #5718).

What happens if you remove the PyQt4 backend and use Spyder with PyQt5 instead?

@ghost
Copy link

ghost commented Nov 19, 2017

Removing the PyQt4 backend and keeping the PyQt5 backend leaves me at the following situation:

[ich@localhost spyder]$ python3 bootstrap.py 
Executing Spyder from source checkout
WARNING: 3rd party Python exception hook is active: '<lambda>'
Revision afeb58173, Branch: test-pl5758
01. Patched sys.path with /home/ich/Kram/spyder
02. PyQt5 is detected, selecting
03. Imported Spyder 3.2.5.dev0
    [Python 3.6.2 64bits, Qt 5.9.1, PyQt5 5.9 on Linux]
04. Running Spyder

Choosing either the Automatic or the Qt5 backend gives me the following message at startup

Python 3.6.2 (default, Sep  1 2017, 12:03:48)
Type "copyright", "credits" or "license" for more information.

IPython 6.2.1 -- An enhanced Interactive Python.

NOTE: The following error appeared when setting your Matplotlib backend

Traceback (most recent call last):
  File "/home/ich/Kram/spyder/spyder/utils/ipython/spyder_kernel.py", line 439, in _set_mpl_backend
    get_ipython().run_line_magic('matplotlib', backend)
  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 2983, in enable_matplotlib
    self.enable_gui(gui)
  File "/usr/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 482, in enable_gui
    real_enable_gui(gui)
  File "/usr/lib/python3.6/site-packages/ipykernel/eventloops.py", line 284, in enable_gui
    raise RuntimeError("Cannot activate multiple GUI eventloops")
RuntimeError: Cannot activate multiple GUI eventloops

…ting an MPL backend

- The problem is not with '/etc/matplotlibrc' setting a backend because
that doesn't take effect until '%matplotlib foo' is run.
- This simplifies the code a lot.
@ccordoba12
Copy link
Member Author

@JakobJakobson, please try your Test Case B again. I changed this PR's approach in my last commit to better inform users about this problem and what Matplotlib backend is going to be used in Spyder's consoles if one is already set.

@ghost
Copy link

ghost commented Nov 20, 2017

Recapping the Test Case B:
The backend in /etc/matplotlibrc is commented, the ~/.config/matplotlib/ folder is empty, the following backends are installed

python-matplotlib-data.noarch                   2.0.0-3.fc27             @fedora
python-matplotlib-data-fonts.noarch             2.0.0-3.fc27             @fedora
python3-matplotlib.x86_64                       2.0.0-3.fc27             @fedora
python3-matplotlib-gtk3.x86_64                  2.0.0-3.fc27             @fedora
python3-matplotlib-qt4.x86_64                   2.0.0-3.fc27             @fedora
python3-matplotlib-qt5.x86_64                   2.0.0-3.fc27         

and I'm using the following Spyder configuration:

[ich@localhost spyder]$ python3 bootstrap.py 
Executing Spyder from source checkout
WARNING: 3rd party Python exception hook is active: '<lambda>'
Revision 8c6c7bf8c, Branch: test-pl5758
01. Patched sys.path with /home/ich/Kram/spyder
02. PyQt5 is detected, selecting
03. Imported Spyder 3.2.5.dev0
    [Python 3.6.2 64bits, Qt 5.9.1, PyQt5 5.9 on Linux]
04. Running Spyder
Bootstrap completed in 00:00:00.9894

and the following plotting file temp.py

# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

import matplotlib.pyplot 
matplotlib.pyplot.plot([1, 2, 3])

Using this configuration leads to the startup/plotting behaviour with the following backends:

  • Automatic
Python 3.6.2 (default, Sep  1 2017, 12:03:48)
Type "copyright", "credits" or "license" for more information.

IPython 6.2.1 -- An enhanced Interactive Python.

NOTE: The following error appeared when setting your Matplotlib backend

Traceback (most recent call last):
  File "/home/ich/Kram/spyder/spyder/utils/ipython/spyder_kernel.py", line 436, in _set_mpl_backend
    get_ipython().run_line_magic('matplotlib', backend)
  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)
  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


In [1]: runfile('/home/ich/.config/spyder-py3/temp.py', wdir='/home/ich/.config/spyder-py3')
Traceback (most recent call last):

  File "<ipython-input-1-70108edc084d>", line 1, in <module>
    runfile('/home/ich/.config/spyder-py3/temp.py', wdir='/home/ich/.config/spyder-py3')

  File "/home/ich/Kram/spyder/spyder/utils/site/sitecustomize.py", line 716, in runfile
    execfile(filename, namespace)

  File "/home/ich/Kram/spyder/spyder/utils/site/sitecustomize.py", line 101, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/home/ich/.config/spyder-py3/temp.py", line 8, in <module>
    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)

  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


In [2]: 

In [2]: 
  • Qt5:
Python 3.6.2 (default, Sep  1 2017, 12:03:48)
Type "copyright", "credits" or "license" for more information.

IPython 6.2.1 -- An enhanced Interactive Python.

NOTE: Spyder *can't* set your selected Matplotlib backend because there is a previous backend already in use.

Your backend will be Qt5Agg

In [1]: runfile('/home/ich/.config/spyder-py3/temp.py', wdir='/home/ich/.config/spyder-py3')
Traceback (most recent call last):

  File "<ipython-input-1-70108edc084d>", line 1, in <module>
    runfile('/home/ich/.config/spyder-py3/temp.py', wdir='/home/ich/.config/spyder-py3')

  File "/home/ich/Kram/spyder/spyder/utils/site/sitecustomize.py", line 716, in runfile
    execfile(filename, namespace)

  File "/home/ich/Kram/spyder/spyder/utils/site/sitecustomize.py", line 101, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/home/ich/.config/spyder-py3/temp.py", line 9, in <module>
    matplotlib.pyplot.plot([1, 2, 3])

  File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 3307, in plot
    ax = gca()

  File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 950, in gca
    return gcf().gca(**kwargs)

  File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 586, in gcf
    return figure()

  File "/usr/lib64/python3.6/site-packages/matplotlib/pyplot.py", line 535, in figure
    **kwargs)

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py", line 44, in new_figure_manager
    return new_figure_manager_given_figure(num, thisFig)

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py", line 51, in new_figure_manager_given_figure
    canvas = FigureCanvasQTAgg(figure)

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py", line 242, in __init__
    super(FigureCanvasQTAgg, self).__init__(figure=figure)

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py", line 66, in __init__
    super(FigureCanvasQTAggBase, self).__init__(figure=figure)

  File "/usr/lib64/python3.6/site-packages/matplotlib/backends/backend_qt5.py", line 240, in __init__
    super(FigureCanvasQT, self).__init__(figure=figure)

TypeError: 'figure' is an unknown keyword argument


In [2]: 

In [2]: 
  • Qt4: shows no plotting window
Python 3.6.2 (default, Sep  1 2017, 12:03:48)
Type "copyright", "credits" or "license" for more information.

IPython 6.2.1 -- An enhanced Interactive Python.

In [1]: runfile('/home/ich/.config/spyder-py3/temp.py', wdir='/home/ich/.config/spyder-py3')

In [2]: 
  • Gtk3: Takes forever to connect
  • Gtk: some further dependencies are not installed
  • Tkinter: shows an unresponsive blank canvas
Python 3.6.2 (default, Sep  1 2017, 12:03:48)
Type "copyright", "credits" or "license" for more information.

IPython 6.2.1 -- An enhanced Interactive Python.

NOTE: Spyder *can't* set your selected Matplotlib backend because there is a previous backend already in use.

Your backend will be TkAgg

In [1]: runfile('/home/ich/.config/spyder-py3/temp.py', wdir='/home/ich/.config/spyder-py3')

In [2]: 

@ccordoba12
Copy link
Member Author

@JakobJakobson, I'm going to merge this one because it's an improvement and I'm not seeing the errors you reported in Ubuntu 17.04, so I think it's an issue exclusive to Fedora (as you already pointed out).

@ccordoba12 ccordoba12 merged commit 3851dba into spyder-ide:3.x Nov 27, 2017
@ccordoba12 ccordoba12 deleted the fix-mpl-auto branch November 27, 2017 00:40
ccordoba12 added a commit that referenced this pull request Nov 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants