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
Matplotlib attempts to import PyQt4 when PyQt5 is not available #8312
Comments
I would support having qt5agg mean exactly that but 1. you need to be check the QT_API environment variable as well and 2. there may be backcompatibility issues. |
The existing code is fine, except for this fallback code. I think it could go through a deprecation cycle as well to address major back compat issues |
Please do submit a patch if you can. |
The source of this is: #5153 which is to play nice with people directly using I suspect the best fix here is to add (yet another) flag to this so we only fall back if we are in the list. Put in a PR because that was faster than explaining how I thought it should be fixed. |
Bug report
Bug summary
dlopen
ing any of the transitive shared object dependencies of PyQt5 fails (happy to dive into the details of how and why this happens, if needed),ImportError
is raised.Code for reproduction
Unfortunately, this case is specific to the installation that I'm working with which is doing some unconventional things. I'm able to reproduce the bug, but not outside the environment I'm working in, and I can't share any code.
Actual outcome
matplotlib attempts to import PyQt5, which fails because
QtGui
cannot be loaded bydlopen
. This causes matplotlib to think that PyQt5 isn't available, because failingdlopen
calls raise anImportError
and subsequently matplotlib will attempt to import PyQt4.Expected outcome
If I say my backend is
Qt5Agg
, that's what I mean. I'd like to know if the backend I've requested is not available, so I can take action to remedy the situation.Matplotlib should examine the error message of the raised
ImportError
and reraise if it's not the standardImportError: No module named 'PyQt5'
I-haven't-installed-something-properly error message. It's very unfortunate thatdlopen
failures during the course ofimport
areImportError
s, but that ship has sailed.Matplotlib version
I'm happy to put a patch up for this.
The text was updated successfully, but these errors were encountered: