Qt.py: PyQt5 __version__ error

I just noticed this when importing PyQt5.

  File "/usr/local/lib/python2.7/site-packages/Qt.py", line 127, in <module>
    _init()
  File "/usr/local/lib/python2.7/site-packages/Qt.py", line 110, in _init
    sys.modules["Qt"] = available[preferred]()
  File "/usr/local/lib/python2.7/site-packages/Qt.py", line 35, in _pyqt5
    PyQt5.__binding_version__ = PyQt5.__version__
AttributeError: 'module' object has no attribute '__version__'

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (4 by maintainers)

Commits related to this issue

Most upvoted comments

i got similar error when using pyinstaller ‘’’ File “/home/chandragupta/anaconda3/envs/pytorch/lib/python3.8/site-packages/PyInstaller/compat.py”, line 632, in importlib_load_source return mod_loader.load_module() File “<frozen importlib._bootstrap_external>”, line 522, in _check_name_wrapper File “<frozen importlib._bootstrap_external>”, line 1027, in load_module File “<frozen importlib._bootstrap_external>”, line 852, in load_module File “<frozen importlib._bootstrap>”, line 265, in _load_module_shim File “<frozen importlib._bootstrap>”, line 702, in _load File “<frozen importlib._bootstrap>”, line 671, in _load_unlocked File “<frozen importlib._bootstrap_external>”, line 848, in exec_module File “<frozen importlib._bootstrap>”, line 219, in _call_with_frames_removed File “/home/chandragupta/anaconda3/envs/pytorch/lib/python3.8/site-packages/PyInstaller/hooks/hook-PyQt5.py”, line 11, in <module> from PyInstaller.utils.hooks.qt import pyqt5_library_info,
File “/home/chandragupta/anaconda3/envs/pytorch/lib/python3.8/site-packages/PyInstaller/utils/hooks/qt.py”, line 162, in <module> pyqt5_library_info = QtLibraryInfo(‘PyQt5’) File “/home/chandragupta/anaconda3/envs/pytorch/lib/python3.8/site-packages/PyInstaller/utils/hooks/qt.py”, line 54, in init if hooks.is_module_satisfies(“PyQt5 >= 5.15.4”): File “/home/chandragupta/anaconda3/envs/pytorch/lib/python3.8/site-packages/PyInstaller/utils/hooks/init.py”, line 502, in is_module_satisfies version = get_module_attribute(module_name, version_attr) File “/home/chandragupta/anaconda3/envs/pytorch/lib/python3.8/site-packages/PyInstaller/utils/hooks/init.py”, line 352, in get_module_attribute raise AttributeError( AttributeError: Module ‘PyQt5’ has no attribute ‘version’ ‘’’

@chandragupta0001 I have the same error. When using the pyinstaller.

resulted in the AttributeError: Module ‘PyQt5’ has no attribute ‘version’ By installing pip install python-qt5. I did not have this any more in the terminal python: import PyQt5 PyQt5.__version__ But the error still existed when using the pyinstaller. Have you found any solution?

Hi all, I had the same issue with pyinstaller. Once I saw this line: File "/home/chandragupta/anaconda3/envs/pytorch/lib/python3.8/site-packages/PyInstaller/utils/hooks/qt.py", line 54, in init if hooks.is_module_satisfies("PyQt5 >= 5.15.4"): I was able to proceed with pyinstaller by downgrading PyQt5 to version 5.15.3 with: pip install --user PyQt5==5.15.3

Warning: I was unable to open spyder after I did that, apparently because of this.

@studentWUR @chandragupta0001

I am also having the issue using pyinstaller via auto-py-to-exe v2.9.0 but not on a computer running v2.7.11. I haven’t yet been able to find a fix. Let me know if either of you find a solution.

I had the same issue with pyinstaller.

Fixed it easy with: pip install pyqt5

I think it was just a bug in the version i’ve had before. Wished it would be always that easy.