반응형
Problem: module 'enum' has no attribute 'IntFlag'
PyQt5의 실행파일을 만들기 위한 pyinstaller 인스톨 할 다음과 같은 경고를 확인하였다.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/setuptools/__init__.py", line 3, in <module>
from fnmatch import fnmatchcase
File "/usr/lib/python3.6/fnmatch.py", line 14, in <module>
import re
File "/usr/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
사실 이전에, pip
으로 설치해보니, 호환성 문제로 구형 버전의 pyinstaller
가 깔렸고, 여차저차 써보니 다음과 같은 에러와 함께 작동 중지가 되었다.
root@jupyter:/home/Workspace/NIMS_posdoc/제이어스/PyQt5# pyinstaller JEIOS_main.py
119 INFO: PyInstaller: 3.3.1
119 INFO: Python: 3.6.9
120 INFO: Platform: Linux-5.4.0-62-generic-x86_64-with-Ubuntu-18.04-bionic
120 INFO: wrote /home/Workspace/NIMS_posdoc/제이어스/PyQt5/JEIOS_main.spec
121 INFO: UPX is not available.
122 INFO: Extending PYTHONPATH with paths
['/home/Workspace/NIMS_posdoc/제이어스/PyQt5',
'/home/Workspace/NIMS_posdoc/제이어스/PyQt5']
122 INFO: checking Analysis
122 INFO: Building Analysis because out00-Analysis.toc is non existent
122 INFO: Initializing module dependency graph...
124 INFO: Initializing module graph hooks...
125 INFO: Analyzing base_library.zip ...
Traceback (most recent call last):
File "<string>", line 41, in <module>
File "<string>", line 13, in walk_packages
File "/usr/lib/python3.6/pkgutil.py", line 127, in iter_modules
for name, ispkg in iter_importer_modules(i, prefix):
File "/usr/lib/python3.6/pkgutil.py", line 146, in _iter_file_finder_modules
import inspect
File "/usr/lib/python3.6/inspect.py", line 41, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/usr/lib/python3.6/tokenize.py", line 33, in <module>
import re
File "/usr/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Traceback (most recent call last):
File "<string>", line 41, in <module>
File "<string>", line 13, in walk_packages
File "/usr/lib/python3.6/pkgutil.py", line 127, in iter_modules
for name, ispkg in iter_importer_modules(i, prefix):
File "/usr/lib/python3.6/pkgutil.py", line 146, in _iter_file_finder_modules
import inspect
File "/usr/lib/python3.6/inspect.py", line 41, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/usr/lib/python3.6/tokenize.py", line 33, in <module>
import re
File "/usr/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
1786 INFO: running Analysis out00-Analysis.toc
1813 INFO: Caching module hooks...
1817 INFO: Analyzing /home/Workspace/NIMS_posdoc/제이어스/PyQt5/JEIOS_main.py
1840 INFO: Loading module hooks...
1840 INFO: Loading module hook "hook-PyQt5.py"...
1841 WARNING: Hidden import "sip" not found!
1841 INFO: Loading module hook "hook-PyQt5.Qt.py"...
1841 WARNING: Hidden import "sip" not found!
1842 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
1842 WARNING: Hidden import "sip" not found!
1842 INFO: Loading module hook "hook-encodings.py"...
Traceback (most recent call last):
File "<string>", line 41, in <module>
File "<string>", line 13, in walk_packages
File "/usr/lib/python3.6/pkgutil.py", line 127, in iter_modules
for name, ispkg in iter_importer_modules(i, prefix):
File "/usr/lib/python3.6/pkgutil.py", line 146, in _iter_file_finder_modules
import inspect
File "/usr/lib/python3.6/inspect.py", line 41, in <module>
import linecache
File "/usr/lib/python3.6/linecache.py", line 11, in <module>
import tokenize
File "/usr/lib/python3.6/tokenize.py", line 33, in <module>
import re
File "/usr/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
1872 INFO: Loading module hook "hook-xml.py"...
2030 INFO: Loading module hook "hook-pydoc.py"...
2030 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
Traceback (most recent call last):
File "<string>", line 2, in <module>
TypeError: __call__() got an unexpected keyword argument 'qualname'
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 8, in <module>
sys.exit(run())
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/__main__.py", line 94, in run
run_build(pyi_config, spec_file, **vars(args))
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/building/build_main.py", line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/building/build_main.py", line 737, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/building/build_main.py", line 213, in __init__
self.__postinit__()
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/building/datastruct.py", line 161, in __postinit__
self.assemble()
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/building/build_main.py", line 472, in assemble
module_hook.post_graph()
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/building/imphook.py", line 410, in post_graph
self._load_hook_module()
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/building/imphook.py", line 377, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/compat.py", line 744, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 823, in load_module
File "<frozen importlib._bootstrap_external>", line 682, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/hooks/hook-PyQt5.QtGui.py", line 18, in <module>
binaries.extend(qt_plugins_binaries('accessible', namespace='PyQt5'))
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/utils/hooks/qt.py", line 65, in qt_plugins_binaries
pdir = qt_plugins_dir(namespace=namespace)
File "/usr/local/lib/python3.6/dist-packages/PyInstaller/utils/hooks/qt.py", line 39, in qt_plugins_dir
raise Exception('Cannot find {0} plugin directories'.format(namespace))
Exception: Cannot find PyQt5 plugin directories
그래서 Exception: Cannot find PyQt5 plugin directories
으로 구글링을 하며 열심히 트래킹을 한 결과,
원인은 enum이다. 하지만 패키지 검색하면 정확히는 enum34
이름도 이눔!! 이눔의녀석!!! 내가 지금 만 34살이지...
여튼 문제는 enum34
enum 말고 enum34
를, 서른 네살의 이눔을 지워버리자...!
** PyQT5에서 쓰는 enum
은 파이썬 기본 모듈인데, 어디선가(?) 깔린 enum34
가 이름이 같아 충돌이 일어나는 원인이었던 것으로...
마치 흔히 pandas
를 쓸 때 column 이름을 count
로 지정하고 df.count
로 안불러와 지는 것과 같은 문제... 동명이인의 문제...
Solution
pip uninstall enum34 -y
pip install pyinstaller
끄읕!
반응형
'Programing Language > Python' 카테고리의 다른 글
[JupyterLab] 필수 업데이트!!! 3.0.12 관련사항 (0) | 2021.03.24 |
---|---|
[python] PDF, CDF, CCDF 그리기 with log binning (0) | 2021.03.05 |
[visualization] Correlation visualization on a geoplot (0) | 2021.01.08 |
[visualization]Multivariate Time Series Visualization (0) | 2020.12.17 |
[datetime] datetime to yearly float (0) | 2020.06.04 |