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

Wrong backend selection with PyQt4 #5650

Closed
soupault opened this issue Dec 10, 2015 · 2 comments
Closed

Wrong backend selection with PyQt4 #5650

soupault opened this issue Dec 10, 2015 · 2 comments

Comments

@soupault
Copy link
Contributor

I'm trying to execute script, which uses only matplotlib (none of PyQt classes/tools directly).
This's the traceback I get:

Traceback (most recent call last):
  File "C:/Workspace/project/src/main.py", line 189, in <module>
    fig, axes = plt.subplots(nrows=nrows, ncols=1, sharex=True)
  File "C:\Miniconda3\lib\site-packages\matplotlib\pyplot.py", line 1177, in subplots
    fig = figure(**fig_kw)
  File "C:\Miniconda3\lib\site-packages\matplotlib\pyplot.py", line 527, in figure
    **kwargs)
  File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 43, in new_figure_manager
    return new_figure_manager_given_figure(num, thisFig)
  File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 50, in new_figure_manager_given_figure
    canvas = FigureCanvasQTAgg(figure)
  File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 216, in __init__
    super(FigureCanvasQTAgg, self).__init__(figure=figure)
  File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 65, in __init__
    super(FigureCanvasQTAggBase, self).__init__(figure=figure)
  File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 239, in __init__
    super(FigureCanvasQT, self).__init__(figure=figure)
TypeError: 'figure' is an unknown keyword argument

Once I add this line to the import sections, everything starts to work fine:

matplotlib.use('Qt4Agg')

SW versions:

  • Python 3.5.1 (conda);
  • PyQt4-4.11.4-cp35-none-win_amd64.whl (C.Gohlke website);
  • matplotlib 1.5.0 (C.Gohlke website);
  • Win 7 x64.

UPD:
Same situation for:

  • Python 3.4.3 (conda);
  • PyQt4-4.11.4-cp34-none-win_amd64.whl (C.Gohlke website);
@WeatherGod
Copy link
Member

One of the changes for v1.5.0 is to prefer Qt5 over Qt4, but it should
still be using the proper library. What else is getting imported in your
script? Does this happen with a minimal example such as:

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

Do you have Qt5 and/or PySide also installed? Also, what backend is set by
your matplotlibrc file?

On Thu, Dec 10, 2015 at 5:05 AM, Panfilov Egor notifications@github.com
wrote:

I'm trying to execute script, which uses only matplotlib (none of PyQt
classes/tools directly).
This's the traceback I get:

Traceback (most recent call last):
File "C:/Workspace/project/src/main.py", line 189, in
fig, axes = plt.subplots(nrows=nrows, ncols=1, sharex=True)
File "C:\Miniconda3\lib\site-packages\matplotlib\pyplot.py", line 1177, in subplots
fig = figure(*_fig_kw)
File "C:\Miniconda3\lib\site-packages\matplotlib\pyplot.py", line 527, in figure
*_kwargs)
File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 43, in new_figure_manager
return new_figure_manager_given_figure(num, thisFig)
File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 50, in new_figure_manager_given_figure
canvas = FigureCanvasQTAgg(figure)
File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 216, in init
super(FigureCanvasQTAgg, self).init(figure=figure)
File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 65, in init
super(FigureCanvasQTAggBase, self).init(figure=figure)
File "C:\Miniconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 239, in init
super(FigureCanvasQT, self).init(figure=figure)
TypeError: 'figure' is an unknown keyword argument

Once I add this line to the import sections, everything starts to work
fine:

matplotlib.use('Qt4Agg')

SW versions:

  • Python 3.5.1 (conda);
  • PyQt4-4.11.4-cp35-none-win_amd64.whl (C.Gohlke website);
  • matplotlib 1.5.0 (C.Gohlke website);
  • Win 7 x64.


Reply to this email directly or view it on GitHub
#5650.

@soupault
Copy link
Contributor Author

Yes, I saw that in #3632 .

Regarding the issue:
I had qt5agg set in .matplotlibrc. Test with config file removed has shown that everything works well.

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

No branches or pull requests

2 participants