Setting up IPython Qtconsole with PyQt5

Pouya picture Pouya · Jun 20, 2014 · Viewed 8.5k times · Source

On an OSX 10.9, I have Qt5 installed. Later I installed Ipython, sip and PyQt5 all build from source. Now here is the problem: when I try to run ipython qtconsole, I have a bunch of errors related to the files in this directory (and its subfolders)

/Library/Python/2.7/site-packages/IPython/

followed by

ImportError:
   Could not load requested Qt binding. Please ensure that
   PyQt4 >= 4.7 or PySide >= 1.0.3 is available,
   and only one is imported per session.

   Currently-imported Qt library:   None
   PyQt4 installed:                 False
   PySide >= 1.0.3 installed:       False
   Tried to load:                   ['pyside', 'pyqt']

I assume the problem is that I have PyQt5 instead of PyQt4. Is this the problem or I have missed some thing else?

Is there anyway that I can have qtconsole with PyQt5? If no, what is the easiest way to do so? (preferably, a method that does not involve having two versions of Qt library on one machine).


For sake of brevity I skipped posting the full error message. Please let me know if I should add them from better understanding of the situation.

Answer

oxtay picture oxtay · Jun 25, 2014

The problem might be related to your python path.

I had almost the exact same problem. I had installed PyQt using Homebrew and I was getting the same error message. Finally what solved the problem was adding the following line to my .bash_profile:

export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH

Since I am a beginner myself, I can't help you any further but I hope this solves the problem.