File "/home/yishen/labelImg-master/resources.py", line 9, in
from PyQt4 import QtCore
RuntimeError: the PyQt4.QtCore and PyQt5.QtCore modules both wrap the QObject class
I don't install pyqt5
Hi,
I have PyQt5. I suggest install PyQt5 and change any reference of PyQt4 to PyQt5 in resources.py and in ./libs/ustr.py.
You will have an error like "ImportError: cannot import name QString" in ustr.py. Just change the line
if type(x) == QString:
to
if type(x) == type('string'):
Closing this because there's already an open issue for this problem: https://github.com/tzutalin/labelImg/issues/212
And it appears you've already found a solution... https://github.com/tzutalin/labelImg/issues/212#issuecomment-377773099
Hi,
I'm using Python 2.7 in Ubuntu 16.4
Rubens
2018-05-26 18:23 GMT-03:00 vdalv notifications@github.com:
What OS are you using, and what version of Python?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tzutalin/labelImg/issues/268#issuecomment-392288950,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AOXvQ2B1eFngc1B_u98_M5u3OEFnWXs5ks5t2ce9gaJpZM4TCuFi
.
meet the same problem.
when I uninstall pyqt4 and use pyqt5 instead,
Traceback (most recent call last):
File "labelImg.py", line 1456, in
sys.exit(main())
File "labelImg.py", line 1452, in main
app, _win = get_main_app(sys.argv)
File "labelImg.py", line 1445, in get_main_app
argv[3] if len(argv) >= 4 else None)
File "labelImg.py", line 98, in __init__
self.settings.load()
File "/home/enjoy-life/labelImg/libs/settings.py", line 33, in load
self.data = pickle.load(f)
ImportError: No module named 'PyQt4'
@osxn Run this command: pyrcc5 -o resources.py resources.qrc
I faced the same issue (I'm using pyqt5). Basically it seems that in qt5 there's no class called string. I used the following workaround in libs/ustr.py and it worked fine:
try:
from PyQt4.QtCore import QString
except ImportError:
# we are using Python3 so QString is not defined
QString = str
This way, when using qt5 you switch to python string instead of QString.
Try to install qt5, run make and finally start application with python3:
$ sudo apt-get install pyqt5-dev pyqt5-dev-tools
$ make qt5py3
$ python3 labelImg.py
I use the code from rkachach ,but error still unsolved.Then I realize maybe it's not an improrerror,so after remove the importerror ,it works.
Most helpful comment
Hi,
I have PyQt5. I suggest install PyQt5 and change any reference of PyQt4 to PyQt5 in resources.py and in ./libs/ustr.py.
You will have an error like "ImportError: cannot import name QString" in ustr.py. Just change the line
if type(x) == QString:
to
if type(x) == type('string'):