HumanSignal / labelImg

LabelImg is now part of the Label Studio community. The popular image annotation tool created by Tzutalin is no longer actively being developed, but you can check out Label Studio, the open source data labeling tool for images, text, hypertext, audio, video and time-series data.
https://youtu.be/p0nR2YsCY_U
MIT License
22.48k stars 6.26k forks source link

PyQt4 and PyQt5 Error running labelImg #212

Open gustavz opened 6 years ago

gustavz commented 6 years ago

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?

AndrewCarterUK commented 6 years ago

I have the same issue

agrichron commented 6 years ago

I meet the same issue,

fionachui commented 6 years ago

I also have the same issue.

xujie32 commented 6 years ago

I met the same issue too.

jinbooooom commented 6 years ago

I met the same issue too.

yishen-zhao commented 6 years ago

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

harryprince commented 5 years ago

same issue +1.

if I use pyqt5:

ImportError: No module named PyQt4.QtGui
tzutalin commented 5 years ago

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

mesargent commented 5 years ago

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

maverik-akagami commented 5 years ago

"make qt4py2" worked for me

ailuropoda0 commented 5 years ago

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

alexstar55 commented 5 years ago

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
heji233 commented 4 years ago

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

sohartma commented 4 years ago

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 ' : ')

suqianxin commented 4 years ago

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.

Asha2411 commented 3 years ago

So, before executing ur python file, make sure to create a virtual env. Worked for me

duonguwu commented 1 year ago

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 ' : ')

Where is libs/ustr.py: ? (I'm using Windown 11)