0

I am packaging an app with Kivy and pyinstaller.

Running the command

python -m PyInstaller --clean --win-private-assemblies -F GroundControl.spec

creates a working executable with the path

\Git\GroundControl\dist\GroundControl\GroundControl.exe

but that folder also contains many other .pyd and .dll files which are needed for the .exe file to run.

Is there a way to truly create just one .exe file to distribute or possibly at least reduce the number of files produced?

Thank you for any advice.

Bar Smith
  • 797
  • 6
  • 20
  • 1
    Possible duplicate of [Kivy: compiling to a single executable](http://stackoverflow.com/questions/35952595/kivy-compiling-to-a-single-executable) – Peter Badida Mar 20 '17 at 11:36

2 Answers2

1

You could use an installer package such as Inno Setup to create one(1) .exe file.

Bill Bridge
  • 821
  • 1
  • 9
  • 30
1

If there are support files that pyinstaller can't figure out to get them included you'll have to specify them by hand.

In your GroundControl.spec need to find the datas entry under Analysis and add dlls and other files in that tuple. More info here.

It should look something like this

a = Analysis(['client.py'],
              pathex=['.'],
              binaries=None,
              datas=[ ('desired_dll.dll', '.') ],
              hiddenimports=[],
              hookspath=[], ...

The most common kivy files that you'll need to add here are .kv ones, as they don't get bundled by default.

A few further notes:

  • you need to run pyinstaller with --onefile
  • if you want to access files at runtime (for instance .kv files) the path for loading them needs to be adjusted. Your app will run in one place, but the files will be unpacked in a different folder. You can find the folder where the files are unpacked by using this var sys._MEIPASS.
Radu Diță
  • 13,476
  • 2
  • 30
  • 34