title: Import Error embedding IPython into PyQt application
body: <p>I have a fully functioning PyQt4 based application that I am now trying to embed an IPython console into for use as a kind of scripting environment.</p>
  
  <p>I've roughly adapted the example from <a href="https://github.com/ipython/ipython/blob/master/examples/inprocess/embedded_qtconsole.py" rel="nofollow">IPython's Github page</a> to fit into my application's module system. However, if <strong>any</strong> PyQt import happens before the IPython imports</p>
  
  <pre><code>from IPython.qt.console.rich_ipython_widget import RichIPythonWidget
  from IPython.qt.inprocess import QtInProcessKernelManager
  </code></pre>
  
  <p>I get the following error:    </p>
  
  <pre><code>ImportError: 
  Could not load requested Qt binding. Please ensure that
  PyQt4 &gt;= 4.7 or PySide &gt;= 1.0.3 is available,
  and only one is imported per session.
  
  Currently-imported Qt library:   'pyqtv1'
  PyQt4 installed:                 True
  PySide &gt;= 1.0.3 installed:       False
  Tried to load:                   ['pyside', 'pyqt']
  </code></pre>
  
  <p>I've traced this error to <code>IPython's</code> <code>qt</code> module, but essentially forcing 'pyqtv1' to be loaded (by replacing <code>api_opts = [QT_API]</code> with <code>api_opts = ['pyqtv1']</code> breaks <code>QString</code> inside the <code>IPython</code> window.</p>
  
  <p>However, if I make it so that those imports happen first (by importing the module this code is in before anything else), that error goes away and it basically breaks <code>QString</code> completely with an <code>ImportError: cannot import name QString</code>. </p>
  
  <p>I've verified that if I make a self-contained <code>QApplication</code> in the module that contains the IPython instance, making sure to import <code>PyQt.QtGui</code> after doing the <code>IPython</code> imports, it works ask expected. It's only when I try and mix the <code>IPython</code> code with any other <code>PyQt</code> code that things break.</p>
  
  <p>Any suggestions as to how to fix the error?</p>
  
  <p>I'm on Ubuntu Linux 12.04, and IPython is version 2.0.0-dev pulled on March 10th.</p>