labelme
labelme copied to clipboard
[BUG] labelme crashes on polygon label assign (qt error)
Describe the bug Error message after a label has been assigned to a created polygon.
$ labelme --labels semseg_labels.txt .
<create polygon>
<assign label>
[INFO ] __init__:get_config:70 - Loading config file from: /home/dimfred/.labelmerc
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/labelme/widgets/label_list_widget.py", line 46, in paint
textRect = style.subElementRect(QStyle.SE_ItemViewItemText, options)
TypeError: subElementRect(self, QStyle.SubElement, QStyleOption, QWidget): not enough arguments
[1] 33391 abort (core dumped) labelme --labels semseg_labels.txt .
To Reproduce Steps to reproduce the behavior:
- labelme --labels label.txt .
- create polygon
- assign label
- see error
Desktop (please complete the following information):
- OS: Manjaro 20.2
- Labelme Version 4.5.6
- qt5-base Version: 5.15.2-1
- python3.8
- PyQt5 Version: 5.15
Additional context Behaviour is the same whether labelme is installed through AUR or through pip.
Possible resolutions
Install lower pyqt5 lib to resolve error.
# breaks some other libs, but at least labelme works
# assumes that current pyqt5 is not installed in the user space
pip3 install --user pyqt5==5.10
I too face the same problem on Arch linux
A solution to a similar issue in another project is found here: https://github.com/spyder-ide/spyder/pull/10215/commits/240e69b43fb32b9b10ea21b0e45d2a137683ed0b.
Simply changing
textRect = style.subElementRect(QStyle.SE_ItemViewItemText, options) to textRect = style.subElementRect(QStyle.SE_ItemViewItemText, options, None) at line 46 solved the problem for me.
I cannot reproduce anymore with
% python --version
Python 3.10.9
% pip freeze | grep -i pyqt
PyQt5==5.15.9
PyQt5-Qt==5.15.2
PyQt5-Qt5==5.15.2
PyQt5-sip==12.11.1