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
Qt5 backend doesn't work with Qt 5.3 #3623
Comments
The QT4 backend explicitly calls init on both of the parent classes: # Note different super-calling style to backend_qt5
QtWidgets.QWidget.__init__(self)
FigureCanvasBase.__init__(self, figure) @mfitzp can you remember why this difference exists between the Qt4 and Qt5 backends |
@jenshnielsen If I remember correctly, the Qt5 backend uses You're correct that the Can you give me some details of your system/setup so I can reproduce? |
This is on a Mac OSX 10.9 with Qt5.3.2, PyQt5 5.3.2 and python 3.4 from Homebrew as well. I know that the backend used to work for me before so I am guessing that this is somehow related to me upgrading to QT5.3 but I haven't tried reinstalling Qt5.2 My understanding of super is that in this context it will call init() on the first class that is inherited from i.e. QtWidgets.QWidget but not on FigureCanvasBase. |
I can confirm that I see the issue that you describe when explicitly initialize the parent classes on Ubuntu 14.04 with Qt 5.2 ... When explicitly calling QtWidgets.QWidget.init(self) it complains about missing figure. When calling QtWidgets.QWidget.init(self, figure=figure) it complains that figure is an unknown kwarg. I think there is a deeper issue here. |
I was hoping Matplotlib 1.4.1 would be out "by October 1rst". |
@stonebig If you really need something that has been fixed on 1.4.x install from source. We have a couple of blocking issues left (take a look at the 1.4.1 milestone), an rc will be tagged once they are cleaned up. If you have spare cycles any help sorting those issues out would be appreciated. |
hi @tacaswell , I'm relying on matplotlib versions (or releases candidates), as distributed by Christoph Gohlke, so it's a break for me to grab the latest source. |
Ok, This actually doesn't have anything to do with qt 5.3 What happens is that I have the env variable QT_API set to pyqt That results in pyqt4 being imported even within the qt5 backend which causes this issue. |
re-labeled this as not-a-blocker as it seems to be a configuration issue. |
I would disagree on this being a config issue. It makes no sense for the matplotlib qt5 backend to be broken in a strange and hard to debug way just because I have set a variable to determine which qt4 library to use in the qt4 backend and in mayavi. The result of the current code is that matplotlib actually imports pyqt4 into the qt5 backend which imho is a clear bug. |
The API switcher in @jenshnielsen PR resolves this by checking the major version specified by the QT_API variable. However, if a v5 of the PySide API becomes available (don't know how likely this is) I think we'd be back in the same situation where it's impossible to specify a version of Qt4 API or Qt5 API independently. Is adding a All this can be handled by logic in the |
Fair enough, I see what I was confused about now. |
I Agree with @mfitzp that this doesn't really work if/when a qt5 compatible version of pyside appears. I think that the simplest and best solution would be an additional env variable to specify which python qt5 implementation to use. But lets wait till we know if that is relevant. |
I suspect that this whole bit of logic should be re-written, but that is a bigger change than we want to make for 1.4.1. |
This is fixed by #3632 which has been merged. |
I am still having this issue: on pyqt5 5.4.2 and matplotlib 1.5.0 matplotlib.use('GTKAgg') here is my error message: File "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5.py", line 239, in __init__
super(FigureCanvasQT, self).__init__(figure=figure)
TypeError: 'figure' is an unknown keyword argument |
Try the rc for v1.5.1, which should have this fix. On Wed, Jan 6, 2016 at 12:32 PM, Flávio Codeço Coelho <
|
Are you calling |
Yes I am. On Wed, Jan 6, 2016 at 3:37 PM, Thomas A Caswell notifications@github.com
Flávio Codeço Coelho+55(21) 3799-5551 |
Can you provide a full example of how to trigger this? import matplotlib
matplotlib.use('gtkagg')
import matplotlib.pyplot as plt should never touch any of the Qt related files. |
This is what I have: import matplotlib
matplotlib.use('GTKAgg', force=True)
from matplotlib import pyplot as P On Wed, Jan 6, 2016 at 4:17 PM, Thomas A Caswell notifications@github.com
Flávio Codeço Coelho+55(21) 3799-5551 |
here is a full example in ipython --pylab plot([1,2,3]) Now if I do a
|
Because using |
I had another library importing pyplot before my call to |
I had a conversation with @WeatherGod about how to delay the import of the On Thu, Jan 7, 2016, 06:45 Flávio Codeço Coelho notifications@github.com
|
I have notes that I made while writing up my book about this idea, but I On Thu, Jan 7, 2016 at 8:17 AM, Thomas A Caswell notifications@github.com
|
I have a working PyQt4 app that I have begun working on upgrading to PQt5; I am running into this same old issue of the missing figure positional argument. My development details: This leaves me with an environment running python 3.5, matplotlib 1.5.1, with an installation of Qt5 and PyQt5. I begin my code with
then later in the code I have
This fails with
Process finished with exit code 1` The code can be seen at github.com/mgrady3/pLEASE in the branch dev_PyQt5 I can try to come up with a minimal working example to recreate this in the mean time EDIT |
You are importing the qt4 backend ( The main difference between pyqt4 and pyqt5 is that with pyqt5 all of the The simple fix is to just change your imports an line 38 and 39 to be from Tom On Wed, Apr 13, 2016 at 11:39 AM M. Grady notifications@github.com wrote:
|
Thanks, Appreciate the help and quick response. |
I'm having this issue too, but even with an incredibly simple test... I cannot for the life of me get this working. The backend set to
Results in this:
Using 2.0.1 with KDE Neon/Qt 5.7.1 and Python 3.5 |
@arcooke I am pretty sure your issue is that you have pyqt4 installed (and not pyqt5). Check that you can import If that does not solve it please try the mailing list, gitter, or creating a new issue. |
@tacaswell A bit off topic, but I did get some errors about missing icons when switching from TkAgg (the only one that worked for me) to Qt5Agg.. does this merit a new thread? I am using Papyrus-Dark icons and it seems to be trying to find a handful of specific icons
|
Yes. please make a new issue for that. |
Done, thank you for the help. 👍 |
I have previously had the Qt5 backend working with mpl 1.4.0 however It seems broken to me now.
Trying to do a simple plot with plt.plot results in
This is naturally because QtWidgets.QWidget does not take a
figure
keyword argument. Removing the kwarg seems to resolve the issue with a simple figure. But I am unsure if the intention of this line is to call init on QtWidgets.QWidget or FigureCanvasBase which does take that kwarg.Since this has working before I guess that this is somehow related to me upgrading to Qt5.3.
The traceback above is from the master branch but the same seems to happen with 1.4.0
The text was updated successfully, but these errors were encountered: