Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
234 views
in Technique[技术] by (71.8m points)

python - Exception: Cannot find PyQt5 plugin directories when using Pyinstaller despite PyQt5 not even being used

A month ago I solved my applcation freezing issues for Python 2.7 as you can see here. I have since adapted my code to python 3.5 (using Anaconda) and it appears to be working. couldn't get pyinstaller working with Anaconda so switched to trying to generate an .exe using the standard Python 3.5 compiler. I am using the same settings as in the link above (pyinstaller --additional-hooks-dir=. --clean --win-private-assemblies pipegui.py), except I get the following error message instead:

`Exception: Cannot find PyQt5 plugin directories`

This may be related? Except I'm using Pyinstaller and I don't have a setup.py so don't know how I can make use of the solution there, if at all

I find this error message bizarre because I am not using PyQt5, but PyQt4. Here is the full output:

C:UsersCornelis Dirk HauptPycharmProjectsMesoscale-Brain-Explorersrc>pyinstaller --additional-hooks-dir=. --clean --win-private-assemblies pipegui.py
62 INFO: PyInstaller: 3.2
62 INFO: Python: 3.5.0
62 INFO: Platform: Windows-10.0.14393
62 INFO: wrote C:UsersCornelis Dirk HauptPycharmProjectsMesoscale-Brain-Explorersrcpipegui.spec
62 INFO: UPX is not available.
62 INFO: Removing temporary files and cleaning cache in C:UsersCornelis Dirk HauptAppDataRoamingpyinstaller
62 INFO: Extending PYTHONPATH with paths
['C:\Users\Cornelis Dirk Haupt\PycharmProjects\Mesoscale-Brain-Explorer',
 'C:\Users\Cornelis Dirk '
 'Haupt\PycharmProjects\Mesoscale-Brain-Explorer\src']
62 INFO: checking Analysis
62 INFO: Building Analysis because out00-Analysis.toc is non existent
62 INFO: Initializing module dependency graph...
62 INFO: Initializing module graph hooks...
62 INFO: Analyzing base_library.zip ...
1430 INFO: running Analysis out00-Analysis.toc
1727 WARNING: Can not get binary dependencies for file: C:Anaconda3api-ms-win-crt-math-l1-1-0.dll
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
1742 WARNING: Can not get binary dependencies for file: C:Anaconda3api-ms-win-crt-runtime-l1-1-0.dll
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
1742 WARNING: Can not get binary dependencies for file: C:Anaconda3api-ms-win-crt-locale-l1-1-0.dll
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
1758 WARNING: Can not get binary dependencies for file: C:Anaconda3api-ms-win-crt-stdio-l1-1-0.dll
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
1758 WARNING: Can not get binary dependencies for file: C:Anaconda3api-ms-win-crt-heap-l1-1-0.dll
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
1774 WARNING: Can not get binary dependencies for file: C:Anaconda3api-ms-win-crt-string-l1-1-0.dll
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
1774 WARNING: Can not get binary dependencies for file: C:Anaconda3api-ms-win-crt-environment-l1-1-0.dll
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
1774 WARNING: Can not get binary dependencies for file: C:Anaconda3api-ms-win-crt-time-l1-1-0.dll
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
1789 WARNING: Can not get binary dependencies for file: C:Anaconda3api-ms-win-crt-filesystem-l1-1-0.dll
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
1789 WARNING: Can not get binary dependencies for file: C:Anaconda3api-ms-win-crt-conio-l1-1-0.dll
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
1789 WARNING: Can not get binary dependencies for file: C:Anaconda3api-ms-win-crt-process-l1-1-0.dll
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
1805 WARNING: Can not get binary dependencies for file: C:Anaconda3api-ms-win-crt-convert-l1-1-0.dll
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 695, in getImports
    return _getImports_pe(pth)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstallerdependindepend.py", line 122, in _getImports_pe
    dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
1805 INFO: Caching module hooks...
1805 INFO: Analyzing C:UsersCornelis Dirk HauptPycharmProjectsMesoscale-Brain-Explorersrcpipegui.py
1992 INFO: Processing pre-find module path hook   distutils
2055 INFO: Processing pre-safe import module hook   six.moves
3181 INFO: Processing pre-find module path hook   site
3181 INFO: site: retargeting to fake-dir 'c:\users\cornelis dirk haupt\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\fake-modules'
4298 INFO: Processing pre-safe import module hook   win32com
9975 INFO: Loading module hooks...
9975 INFO: Loading module hook "hook-_tkinter.py"...
10121 INFO: checking Tree
10121 INFO: Building Tree because out00-Tree.toc is non existent
10122 INFO: Building Tree out00-Tree.toc
10184 INFO: checking Tree
10184 INFO: Building Tree because out01-Tree.toc is non existent
10185 INFO: Building Tree out01-Tree.toc
10198 INFO: Loading module hook "hook-matplotlib.py"...
10404 INFO: Loading module hook "hook-pywintypes.py"...
10526 INFO: Loading module hook "hook-xml.py"...
10526 INFO: Loading module hook "hook-pydoc.py"...
10527 INFO: Loading module hook "hook-scipy.linalg.py"...
10527 INFO: Loading module hook "hook-scipy.sparse.csgraph.py"...
10529 INFO: Loading module hook "hook-plugins.py"...
10721 INFO: Processing pre-find module path hook   PyQt4.uic.port_v3
10726 INFO: Processing pre-find module path hook   PyQt4.uic.port_v2
12402 INFO: Loading module hook "hook-OpenGL.py"...
12583 INFO: Loading module hook "hook-PyQt4.QtGui.py"...
12802 INFO: Loading module hook "hook-encodings.py"...
12807 INFO: Loading module hook "hook-PyQt4.uic.py"...
12812 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
12813 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
12813 INFO: Loading module hook "hook-setuptools.py"...
12814 INFO: Loading module hook "hook-scipy.special._ufuncs.py"...
12814 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ImportError: DLL load failed: The specified procedure could not be found.
Traceback (most recent call last):
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35lib
unpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35lib
unpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:UsersCornelis Dirk HauptAppDataLocalProgramsPythonPython35Scriptspyinstaller.exe\__main__.py", line 9, in <module>
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstaller\__main__.py", line 90, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstaller\__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstalleruildinguild_main.py", line 788, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:userscornelis dirk hauptappdatalocalprogramspythonpython35libsite-packagesPyInstalleruildinguild_main.py", line 734, in buil

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I managed to fix the same problem I encountered (conda 4.5.4, pyinstaller 3.4) without uninstalling conda:

pip install PyQt5

conda already installed PyQt when I used conda install jupyter seaborn. Interestingly, using conda install PyQt5 does not fix my problem. I don't know why. In any case I hope this may help someone out there.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...