Pyinstaller with MATLAB engine
显示 更早的评论
Hello,
I am working on a project which uses Python to create a GUI for a MALTAB project. I have created a Conda environment and the GUI project works well in this environment. Then I try to use Pyinstaller to encapsulate this project and there are some problems with the MATLAB engine.
Details of this project: MATLAB: 2022b; Python: 3.8; OS: Ubuntu: 22.04
The error message is as the following:
Could not initialize type.
Traceback (most recent call last):
File "readfile_main.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 500, in exec_module
File "matlab/__init__.py", line 53, in <module>
from matlabmultidimarrayforpython import
SystemError: initialization of matlabmultidimarrayforpython raised unreported exception
[2155559] Failed to execute script 'readfile_main' due to unhandled exception!
The Python version and MATLAB version are a good match, and I can find all the necessary files, such as 'matlabmultidimarrayforpython.so' under my matlab installation directory ('/usr/local/MATLAB/R2022b/extern/bin/glnxa64/'). I have everything the MATLAB engine needs.
Also, I found some error messages about the modules PyInstaller was not able to find that appear in the Pyinstaller log ('warn-readfile_main.txt'):
missing module named pyimod02_importers - imported by /home/xdai/anaconda3/envs/gui_2022/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_pkgutil.py (top-level)
missing module named matlabmultidimarrayforpython - imported by matlab (top-level), /home/xdai/Desktop/gui_exe/readfile_main.py (top-level)
missing module named _scproxy - imported by urllib.request (conditional)
missing module named StringIO - imported by matlab.engine.matlabengine (optional)
missing module named matlab.engine.MatlabExecutionError - imported by matlab.engine (top-level), matlab.engine.matlabengine (top-level)
missing module named matlab.engine.CancelledError - imported by matlab.engine (top-level), matlab.engine.matlabfuture (top-level)
missing module named matlab.engine.TimeoutError - imported by matlab.engine (top-level), matlab.engine.matlabfuture (top-level), matlab.engine.fevalfuture (top-level)
I would appreciate it a lot if you can help me with this problem. If you need more information, please let me know.
Thanks for the help in advance!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Call MATLAB from Python 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!