I have made an application using pyqt
. when running from an IDE the .py files work good. However when running the .exe file using:
pyinstaller --name="Myapp" --windowed --onefile main.py
I get a .exe file. When I try to run it it says
Failed to execure script main
I tried again but this time with :
pyinstaller main.py
It did generated a folder named main
in dist
. I ran main.exe
in command line and I get :
ImportError: No module named 'mlarray'
I went to the matlab
library for python that I had installed in \Python\Python36\Lib\site-packages\matlab
and changed mlarray.py
as following:
from
from _internal.mlarray_sequence import _MLArrayMetaClass
To:
from matlab._internal.mlarray_sequence import _MLArrayMetaClass
I even changed __init__.py
:
from:
from mlarray import double, single, uint8, int8, uint16, \
int16, uint32, int32, uint64, int64, logical
from mlexceptions import ShapeError as ShapeError
from mlexceptions import SizeError as SizeError
to:
from matlab.mlarray import double, single, uint8, int8, uint16, \
int16, uint32, int32, uint64, int64, logical
from matlab.mlexceptions import ShapeError as ShapeError
from matlab.mlexceptions import SizeError as SizeError
Finally I changed Python\Python36\Lib\site-packages\matlab\_internal\mlarray_sequence.py
from:
from _internal.mlarray_utils import _get_strides, _get_size, \
_normalize_size, _get_mlsize, _reshape
to:
from matlab._internal.mlarray_utils import _get_strides, _get_size, \
_normalize_size, _get_mlsize, _reshape
Saved all the work and try to do pyinstaller again.
pyinstaller main.py
and this time I get following error:
File "site-packages\matlab\engine\__init__.py", line 62, in <module>
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: [Errno 2] No such file or directory: 'C:\\pmafgx_das\\das2\\main\\ReleaserQt\\dist\\main\\matlab\\engine\\_arch.txt'
[2028] Failed to execute script main
It is getting very frustrating and I don't know what to do more. Please if you have an insights I would appritiate if you could help me.