labelme icon indicating copy to clipboard operation
labelme copied to clipboard

module 'qtpy.QtGui' has no attribute 'QRegExpValidator'

Open monkeycc opened this issue 2 years ago • 4 comments

Provide environment information

anaconda Python 3.8.16 labelme 5.1.1


certifi 2022.12.7 colorama 0.4.6 contourpy 1.0.7 cycler 0.11.0 fonttools 4.38.0 imgviz 1.7.0 kiwisolver 1.4.4 labelme 5.1.1 matplotlib 3.6.3 natsort 8.2.0 numpy 1.24.2 packaging 23.0 Pillow 9.4.0 pip 22.3.1 pyglet 2.0.3 pyparsing 3.0.9 PySide6 6.4.2 PySide6-Addons 6.4.2 PySide6-Essentials 6.4.2 python-dateutil 2.8.2 PyYAML 6.0 QtPy 2.3.0 setuptools 65.6.3 shiboken6 6.4.2 six 1.16.0 termcolor 2.2.0 wheel 0.37.1 wincertstore 0.2


pip install labelme pip install PySide6

What OS are you using?

win11

Describe the Bug

pip install labelme

labelme

Traceback (most recent call last):
  File "D:\anaconda31114\envs\biaozhu\lib\site-packages\qtpy\__init__.py", line 252, in <module>
    from PySide6 import __version__ as PYSIDE_VERSION  # analysis:ignore
ModuleNotFoundError: No module named 'PySide6'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\anaconda31114\envs\biaozhu\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\anaconda31114\envs\biaozhu\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\anaconda31114\envs\biaozhu\Scripts\labelme.exe\__main__.py", line 4, in <module>
  File "D:\anaconda31114\envs\biaozhu\lib\site-packages\labelme\__init__.py", line 6, in <module>
    from qtpy import QT_VERSION
  File "D:\anaconda31114\envs\biaozhu\lib\site-packages\qtpy\__init__.py", line 259, in <module>
    raise QtBindingsNotFoundError()
qtpy.QtBindingsNotFoundError: No Qt bindings could be found

pip install PySide6

labelme

Traceback (most recent call last):
  File "D:\anaconda31114\envs\biaozhu\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\anaconda31114\envs\biaozhu\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\anaconda31114\envs\biaozhu\Scripts\labelme.exe\__main__.py", line 7, in <module>
  File "D:\anaconda31114\envs\biaozhu\lib\site-packages\labelme\__main__.py", line 172, in main
    win = MainWindow(
  File "D:\anaconda31114\envs\biaozhu\lib\site-packages\labelme\app.py", line 101, in __init__
    self.labelDialog = LabelDialog(
  File "D:\anaconda31114\envs\biaozhu\lib\site-packages\labelme\widgets\label_dialog.py", line 49, in __init__
    self.edit.setValidator(labelme.utils.labelValidator())
  File "D:\anaconda31114\envs\biaozhu\lib\site-packages\labelme\utils\qt.py", line 72, in labelValidator
    return QtGui.QRegExpValidator(QtCore.QRegExp(r"^[^ \t].+"), None)
AttributeError: module 'qtpy.QtGui' has no attribute 'QRegExpValidator'

Expected Behavior

No response

To Reproduce

No response

monkeycc avatar Feb 10 '23 12:02 monkeycc

Got the same AttributeError: module 'qtpy.QtGui' has no attribute 'QRegExpValidator' problem.

gurubac avatar Feb 19 '23 21:02 gurubac

Maybe you should try PySide6 6.3.1.

chenxinfeng4 avatar Feb 20 '23 09:02 chenxinfeng4

Maybe you should try PySide6 6.3.1.

Tried it in Ubuntu, still seeing the same bug.

chungusmungus555 avatar Feb 20 '23 09:02 chungusmungus555

Please use PySide2, because of API changes of PySide6. For this issues, you just need use QRegularExpressionValidator in PySide6 to replace it. But in addition to this issue, there are too many compatibility issues. I gave up using PySide6.

luooyii avatar Mar 07 '23 02:03 luooyii