Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Qt console crashes on Ubuntu 11.10 #812

fperez opened this Issue · 21 comments

5 participants


Reported by a user on-list, when starting the qt console with --pylab.

@epatters, does the traceback ring any bells regarding possible Qt api changes you're aware of?


IPython post-mortem report

{'commit_hash': '3994edb',
 'commit_source': 'installation',
 'ipython_path': '/usr/local/lib/python2.7/dist-packages/IPython',
 'ipython_version': '',
 'os_name': 'posix',
 'platform': 'Linux-3.0.0-11-generic-i686-with-Ubuntu-11.10-oneiric',
 'sys_executable': '/usr/bin/python',
 'sys_platform': 'linux2',
 'sys_version': '2.7.2+ (default, Aug 16 2011, 07:29:45) \n[GCC 4.6.1]'}



Crash traceback:

TypeError                                    Python 2.7.2+: /usr/bin/python
                                                   Wed Sep 21 02:40:27 2011
A problem occured executing Python code.  Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
/usr/local/lib/python2.7/dist-packages/IPython/frontend/qt/console/console_widget.pyc in sizeHint(self=)
    352         # Note 1: Despite my best efforts to take the various margins into
    353         # account, the width is still coming out a bit too small, so we include
    354         # a fudge factor of one character here.
    355         # Note 2: QFontMetrics.maxWidth is not used here or anywhere else due
    356         # to a Qt bug on certain Mac OS systems where it returns 0.
    357         width = font_metrics.width(' ') * 81 + margin
    358         width += style.pixelMetric(QtGui.QStyle.PM_ScrollBarExtent)
    359         if self.paging == 'hsplit':
    360             width = width * 2 + splitwidth
    362         height = font_metrics.height() * 25 + margin
    363         if self.paging == 'vsplit':
    364             height = height * 2 + splitwidth
--> 366         return QtCore.QSize(width, height)
    368     #---------------------------------------------------------------------------
    369     # 'ConsoleWidget' public interface
    370     #---------------------------------------------------------------------------
    372     def can_copy(self):
    373         """ Returns whether text can be copied to the clipboard.
    374         """
    375         return self._control.textCursor().hasSelection()
    377     def can_cut(self):
    378         """ Returns whether text can be cut to the clipboard.
    379         """
    380         cursor = self._control.textCursor()
    381         return (cursor.hasSelection() and 

TypeError: arguments did not match any overloaded call:
  QSize(): too many arguments
  QSize(int, int): argument 1 has unexpected type 'float'
  QSize(QSize): argument 1 has unexpected type 'float'


Previously sent bug report had a bit more info, so I'm posting it in case it's relevant (this is 0.11 and above is 0.12dev):

--> 362         return QtCore.QSize(width, height)
        global QtCore.QSize = <class 'PyQt4.QtCore.QSize'>
        width = -4269769018.0
        height = 335.0
    364     #---------------------------------------------------------------------------
    365     # 'ConsoleWidget' public interface
    366     #---------------------------------------------------------------------------

Also --pylab switch does not play any role in this bug


I found out that line c.IPythonWidget.paging = 'hsplit' in causes this issue

Also running ipython qtconsole --paging=hsplit causes this on my system

ipython qtconsole --paging=vsplit runs fine


Seems simple enough - QtCore.QSize officially expects int, but sometimes we pass it floats. Some combinations of bindings (e.g. my PySide right now) will just cast floats to int, but we apparently can't rely on it. A simple cast before call should suffice.

@minrk minrk referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.

@zetah - if you can confirm that this fixes the issue, I'll merge and close.


After that running ipython qtconsole --paging=hsplit was without crash. Only that in this situation hsplit wasn't working at all, but default inline split. (Maybe I should remind that IPython documentation about hsplit/vsplit is oposite of how this commands behaves)

I then uncommented line c.IPythonWidget.paging = 'hsplit' in and IPython crashes again unfortunatelly:

    359         if self.paging == 'hsplit':
    360             width = width * 2 + splitwidth
    362         height = font_metrics.height() * 25 + margin
    363         if self.paging == 'vsplit':
    364             height = height * 2 + splitwidth
--> 366         return QtCore.QSize(int(width), int(height))
        global QtCore.QSize = <class 'PyQt4.QtCore.QSize'>
        global int = undefined
        width = -4234948154.0
        height = 335.0
    368     #---------------------------------------------------------------------------
    369     # 'ConsoleWidget' public interface
    370     #---------------------------------------------------------------------------

Now it crashes also from command line (with --paging=hsplit switch) even if I revert changes in

BTW above process crashed also Metacity once and this line I get always when running qtconsole:

(python:2506): Gtk-CRITICAL **: IA__gtk_widget_style_get: assertion `GTK_IS_WIDGET (widget)' failed

In the past only ipython internals were shown in terminal when after launching qtconsole


If I run with arguments qtconsole --paging=hsplit from latest git source, without applied minrk patch with i.e. PyCharm (while trying to debug that negative width float number), everything seems fine and hsplit is working properly

If I go to location of and try with python qtconsole --paging=hsplit this bug emerges, which is logical since it loads already installed IPython modules. But what can be problem


I'm having hard time trying to figure the problem. I somehow managed to reproduce this with import from installed IPython folder (/usr/local/lib/python2.7/dist-packages/IPython/) in PyCharm, as annotating variables (in to outside file object did not return any result.

If we look at fperez initial post, at line 357 width has value 496.0, but on next value random large number returned by style.pixelMetric(QtGui.QStyle.PM_ScrollBarExtent). For now, I've been able to extract just this about this object:

style.pixelMetric = <built-in method pixelMetric of QCommonStyle object at 0x969789c>
global QtGui.QStyle.PM_ScrollBarExtent = 9

OK, it's definitelly this function that return large int for some reason:



This fixes issue for me (line 358 in ipython 0.12dev):

- width += style.pixelMetric(QtGui.QStyle.PM_ScrollBarExtent)
+ width += QtGui.QStyle.PM_ScrollBarExtent

:D but it's not very good fix, as splitter now can't be adjusted.


Note that there is a general problem with qt apps on ubuntu 11.10
that results in:
(python:2901): Gtk-CRITICAL **: IA__gtk_widget_style_get: assertion `GTK_IS_WIDGET (widget)' failed
in a lot of qt apps. (vlc and others)
This can be worked around by launching ipython qtconsole like this.
LIBOVERLAY_SCROLLBAR=0 ipython qtconsole


Thanks for the info. I already downloaded tons of packages just to be able to change default fonts.
Upgrading to 11.10 was really bad idea for me, performance degraded on multiple levels... but can't go back unless clean install again. Which I might do in days to come


Starting with sudo ipython qtconsole --paging=hsplit runs without issue

@jenshnielsen: Are you running 11.10 also? Can you confirm this issue?

Now if you excuse me I have to catch Tuxedomoon's concert ^_^


Yes running ipython qtconsole --paging=hsplit does seem to give problems. I have not tried the int() fix from
however running the console without the overlay scroll bars by starting the qt console like this
LIBOVERLAY_SCROLLBAR=0 ipython qtconsole fixes the problem for me. So please try this.
I think this fix should make its way into ubuntu 11.10 soon.


the packaged ipython 0.11 (available here: works fine for me in 11.10
Can you test with that package?


The problem that I see happens for even simple qt apps in ubuntu 11.10


import sys
from PySide import QtGui

app = QtGui.QApplication(sys.argv)
a = QtGui.QTextEdit()

a.resize(250, 150)

gives the same error. It can also be fixed by changing the qt gui style
using qtconfig-qt4 to anything but gtk+


@fperez, sorry, I've been off-line for a few days. It looks like this is an Ubuntu-specific problem, but I'll keep my eye on the issue in case there are some new developments.


@jenshnielsen: qtconfig setting solved this issue (I forgot to try LIBOVERLAY_SCROLLBAR=0). Now there is small problem with unreadable white font on pale yellow background for tooltips, but I guess I spamed enough IPython issues with irrelevant problems.

Cheers and thanks


No problem. Thanks for confirming the workaround.

@epatters epatters closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.