Search code examples
pythonkivypyinstallerexe

Creating an executable kivy app and exe installer


I created a data-miner GUI for twitter with kivy and am currently having a lot of trouble turning it into an exe. I tried following this video and import glew and sdl2 into my spec but after doing pyinstaller main.spec, my executable still would not open.

Is it because I have more than one files and folders for my program (here is the link to the github repo for my project), if so, how do you deal with that?

In addition, if I manage to success create a working exe, how do I create an exe installer that other people can use to install the executable?


Solution

  • Making an executable from a complex script like yours may become quite frustrating because of its dependencies. But I'm giving you a brief guide about what you need to follow to achieve your goal.

    1. Create your main.spec file with console-mode enabled to see the exact error message for the app. (make sure to remove --noconsole from PyInstaller command or set console=True in spec file). Also use --no-upx in the build command to remove compression from output file (this helps with omitting some DLLs which may cause issues).

    2. You need to make sure that every external module you used can pack correctly. I don't think you get any problem with either Kivy or Tweepy. But if you get any missing import error, try to check the solution for each one by searching the pattern [module] pyinstaller.

    3. Your app has external resources like images, files, etc., which must be added to the packed executable and load properly. I wrote an answer about this here.

    4. If you want a standalone executable, you need to use -F with PyInstaller command, which is more robust than using an installer to gather files in one directory mode.