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

check for complete pyside presence before trying to import #2757

Merged
merged 1 commit into from Jan 14, 2013

Conversation

juliantaylor
Copy link
Contributor

importing pyside partially and then falling back to pyqt causes a crash
in sip (see gh-1431)
To avoid it try to locate all modules before the import and should that
fail print a warning.

debian splits pyside into many small packages so sometimes people end up with incomplete pyside installations.

importing pyside partially and then falling back to pyqt causes a crash
in sip (see ipythongh-1431)
To avoid it try to locate all modules before the import and should that
fail print a warning.
@@ -35,6 +44,11 @@ def prepare_pyqt4():
prepare_pyqt4()
import PyQt4
from PyQt4 import QtCore, QtGui, QtSvg
if pyside_found:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what condition does it reach this point with pyside_found=True? It looks like, if it can't find the modules it needs, ImportError is raised while pyside_found is still False.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_module does not load the module.
It is possible that one of these module is on the disk but can't be loaded, if the others load it will likely still crash so a warning is printed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would prevent them being loaded? Permissions error? How could that arise? I think it's OK to handle these corner cases in the main code base, I just want to work out what it is we're dealing with.

Am I right in thinking that you're handling two different cases here? The section above using find_module avoids loading the PySide modules unless all the ones we need are present, so that we can fall back to PyQt4 if some are missing. That bit I think I follow. This second addition I'm more hazy about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its pretty paranoid, but plenty things could happen e.g. undefined symbols due to linking errors, all kind of issues due to binary incompatibilities.
but as qt is a pretty core package if its broken you probably have bigger issues than ipython then, so the warning could be dropped.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair enough. I guess my concern is that if we don't know a likely reason for this result, any suggestions in the message are liable to be unhelpful. But I guess a general "your dodgy PySide installation is a likely culprit" is better than nothing.

I'm happy for this to go in.

@juliantaylor
Copy link
Contributor Author

as this is a debian only problem I'm fine with carrying that patch in the package alone (or change the package to depend on the complete python-pyside metapackage)

@minrk
Copy link
Member

minrk commented Jan 8, 2013

@takluyver I recommended that @juliantaylor open a PR, even if it only ends up as a debian patch, just so we have a record of it. The disadvantage of merging it is we are taking responsibility for a package-management issue. The advantage is this issue can still come up for IPython installed manually on a debian system with incomplete pyside.

@bfroehle
Copy link
Contributor

I'm indifferent to the proposed patch. Go ahead and merge it if you like.

@takluyver
Copy link
Member

We all seem to be ambivalent about merging this. On the plus side, users who install IPython on Debian-based systems outside apt would benefit from it. The downside would be a little extra complexity to handle an odd corner case.

I suggest we merge it. The complexity would exist anyway, just as a Debian patch, and I think it's a good idea to minimise the amount of patches we make distributions apply.

@bfroehle , @minrk : any objections? If not, I'll merge this tomorrow.

@bfroehle
Copy link
Contributor

No, it's fine with me.

@minrk
Copy link
Member

minrk commented Jan 14, 2013

Sounds good to me.

bfroehle added a commit that referenced this pull request Jan 14, 2013
check for complete pyside presence before trying to import
@bfroehle bfroehle merged commit de2743b into ipython:master Jan 14, 2013
minrk added a commit that referenced this pull request Mar 5, 2013
…o import

importing pyside partially and then falling back to pyqt causes a crash
in sip (see gh-1431)
To avoid it try to locate all modules before the import and should that
fail print a warning.

debian splits pyside into many small packages so sometimes people end up with incomplete pyside installations.
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
check for complete pyside presence before trying to import
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.

None yet

4 participants