Closed jackreid closed 3 years ago
So I took a first pass at this and got it work, but definitely not in an ideal fashion.
I was unable to get pyinstaller to work using the "--onefile" portion of the command. When I tried to run the executable after making it using "--onefile" it would just automatically close.
I then ran pyinstaller without the onefile command, which leads to a folder that has an .exe in it and many other accompanying files. This executable would still not run, so I did some digging.
It turns out in order to get this to run, two manual changes must be made: 1) The "mpl-data" folder must be moved inside the "matplotlib" folder. This appears to be an open issue with pyinstaller: https://github.com/pyinstaller/pyinstaller/issues/5004 2) the "Data" folder and "translations.csv" must be copied into the folder that the executable is in when it runs.
Once these changes are made, the executable runs fine on my computer. I made one for both Indonesia and Rio.
However there are two other pertinent issues: 1) When I zipped up the folder containing the executable and sent it to my personal laptop to see if it would run on another machine, my antivirus wouldn't allow it to run. After adding the file as an exclusion in the antivirus software, it ran fine, but we should look into how to make it look less like I virus I guess? 2) The sizing of the window is fixed. My monitor on my other machine is much smaller, and as such, all of the buttons were cut off when I ran it.
Suboptimal but maybe workable. A few questions:
1) What is the size of the zip? Is it something that can be emailed or reasonable linked to on Google Drive?
2) With regard to your manual change 2, do you mean that you copy the entire "Data" folder or just one specific location (i.e. Indonesia)? If the former, annoying but fine. If the latter, it probably means that the in-app location switching probably won't work.
1) the zips are 124 mb each, so not great, but not unusable for google drive. 2) Its the entire data folder, I have not tried the switching between contexts in the executable though. Is that currently implemented in the script?
Regarding 2, yes, in the current version (which looks like you have in the screenshots from the other thread), there are some commands in the top left of the window. First one allows switching languages in-app. Second allows switching locations in-app. Third one closes the app. Give it a try and let me know if you have any issues.
If the zip seems to be working, could you upload it to the Space Enabled Google Drive? The best place is probably Research/Integrated Modeling/Decision Modeling, but if you have a better idea, feel free to do so and just let me know.
And an idea regarding the --onefile command. Maybe try commenting out the three lines right near the bottom of SD_UI_V1_5.py (lines 1394-1396 currently), that open and then close a window. Maybe that will resolve the executable issue. Maybe not though.
Seems that language and location switching work in the executable, that's cool functionality!
I have uploaded the .zips here: https://drive.google.com/drive/folders/17HYgsfzwaV8KUQ0sqraG6P6qtuHdZJ2k?usp=sharing
I will give your onefile idea a look when I sit down with the code again
We should also put the executable in the github as well.
So I was having errors when I tried to upload the executable .zip files to github, so to see if it was just a general issue on my end (hence my most recent commit where I just created the executables folder with a text file in it).
However, digger deeper into the error message, I found these two lines:
remote: error: File executables/SD_UI_v1_5.zip is 121.56 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File executables/SD_UI_v1_5_brazil(1).zip is 121.58 MB; this exceeds GitHub's file size limit of 100.00 MB
So, seems like I can't upload the .zip files to git, at least on my end
One option would then be to upload the unzipped folder in it's entirety. People could then download it as a zip.
Shea or someone else running Windows should use pyinstaller to make a windows executable version. Right now it will just have all the data baked in, but we can work on adding automatic data pulling or data import functionality later