Labelimg: PyQt4 and PyQt5 Error running labelImg

Created on 18 Dec 2017  路  15Comments  路  Source: tzutalin/labelImg

I am working with python 2.7 so i wanted to use PyQt4. But when i follow the guide
sudo apt-get install pyqt4-dev-tools
sudo pip install lxml
make qt4py2
python labelImg.py

it gives me following error:
$ python labelImg.py Traceback (most recent call last): File "labelImg.py", line 27, in <module> import resources File "/home/gustav/DataSet/labelImg/resources.py", line 9, in <module> from PyQt4 import QtCore RuntimeError: the PyQt4.QtCore and PyQt5.QtCore modules both wrap the QObject class

although i do not have PyQt5 installed, only PyQt4.
(The same happens if i install globaly with pip (or pip2))

But however if i follow the same steps for python 3 and PyQt5 it works perfectly fine.

The thing is, i really would prefer to use the py2.7.

Any suggestions how to solve this?

  • OS: Ubuntu 16.04
  • PyQt version: PyQt4 and PyQt5

Most helpful comment

If you are using pyqt5, you should call 'make qt4py2' or 'makr qt5py2'

All 15 comments

I have the same issue

I meet the same issue,

I also have the same issue.

I met the same issue too.

I met the same issue too.

I met this issue too .when I uninstall pyqt4 and use pyqt5 instead,I solve the problem!

same issue +1.

if I use pyqt5:

ImportError: No module named PyQt4.QtGui

If you are using pyqt5, you should call 'make qt4py2' or 'makr qt5py2'

I had both pyqt5 and pyqt4 installed and got the same problem. When I uninstalled pyqt5 it worked.

"make qt4py2" worked for me

If there is an error for calling 'make qt4py2' or 'make qt5py2',
do 'make qt4' or 'make qt5' first.

I edited libs/ustr.py:

  1. comment this line:#from PyQt4.QtCore import QString
  2. change this:if type(x) == QString
    to this:if type(x) ==type('string')
    and it works

I got the issue but "make qt4py3" didn't work馃槶

I edited libs/ustr.py:

1. comment this line:#from PyQt4.QtCore import QString

2. change this:if type(x) == QString
   to this:if type(x) ==type('string')
   and it works

Worked for me, thanks!
First, i uninstalled qt4, installed qt5, then make qt5py3, then applied your solution (don't forget ' : ')

I have the same issue

I have the same issue when use the py2+qt4,but when i build a conda virtual environment for py3+qt5,it works.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JNKielmann picture JNKielmann  路  6Comments

javadba picture javadba  路  4Comments

vanangamudi picture vanangamudi  路  3Comments

315386775 picture 315386775  路  4Comments

LucasVandroux picture LucasVandroux  路  4Comments