My app starts in remote="False" , m.options.SOLVER=3 mode and works fine in vscode. I needed to convert to exe file. Auto-Py-To-Exe can generate an exe file from a Python program. I managed to generate the exe from my gekko script. But when running the program, the solver shows these errors:
Error: The system cannot find the specified path.
Error: 'results.json' not found. Check above for more error details,
[Errno 2] No such file or directory: 'C:\\Users\\****\\AppData\\Local\\Temp\\tmpfzmt2vvbgk_model0\\options.json'
At runtime m.open_folder() can open the gekko path in the temp folder, but these files can't seem to be created.
In case of remote="True" and server=localhost: I try to run apmonitor server on localhost and it's ok in browser, but in code like this m = GEKKO(remote=True, server="http://127.0 .0.1") does not find the server and shows this error:
Server not found or unreachable.
In Remote="True" mode and default server: it works fine in code and exe file.
How to solve the above errors? The first mode, Remote="False" is important to me.
This is the temp folder that the resolver creates in temp:
UPDATE: In auto-py-to-exe and other extensions like py2exe and pyinstaller you just need to say "include Gekko data files". The auto-py-to-exe interface includes the --hidden-import
and --collect-data
options and must be set to from PyInstaller.utils.hooks import collect_data_files
and gekko
.
- You need to install pyinstaller and auto-py-to-exe
In pyinstaller: Compiling Gekko with Pyinstaller
Thank you mr. hedengren.