Ipython Qtconsole

This post record how I setup ipython qtconsole and what problem I encountered.

qtconsole need PyQt4 or PySide installed, here I choose PyQt4.

to install PyQt4, need to setup SIP first, these two need install from source code.

ps. it is recommend to setup python in virtual env with pyenv first.

dependency

Install some dev packages for building source code.

1
sudo apt-get install python-dev python-qt4 python-qt4-dev python-sip python-sip-dev build-essential gfortran libqt4-dev qt4-qmake libpq-dev libsqlite3-dev qt4-dev-tools qt4-doc unixodbc-dev pyqt4-dev-tools

SIP

download source code

1
2
3
python config.py
make
make install

PyQt4

this is the tricky part. Since current version of PyQt4 is 4.10, which broken with ipython. I found someone with similiar problem spyderlib issues, it says ipython is working on it, so I clone the dev version of ipython from github, but it still not working. I endup choose previous version of PyQt4 4.9.4 and it works!!

source code

1
2
3
python configure.py
make
make install

if you have Qt4 and Qt5 both installed, you maybe have problem when running configure.py, because the enviroment is set for Qt5 not Qt4, we need to tell python to use Qt4 explicitly.

1
export QMAKESPEC=/usr/share/qt4/mkspecs/default

and run configure.py with

1
python configure.py -q qmake-qt4

reference

installing-pyqt4-and-sip-in-a-virtual-environment-ubuntu-1204

Comments