[Date] 23 Apr 2020
[Environment]
- Python 3.7
- Kivy 1.11.1
- PyInstaller 3.6
- OS: Windows 10 Pro 1809 (Required for MSIX)
Separate installation and working directories. You will not be able to modify the installation directory. Therefore, use local data directory for the files you will change.
You can get the local application data dir by:
self.workdir = os.environ['APPDATA']
-
First, read Kivy Guide.
-
Install python3
Python3.7 should be 64 bit for 64 bit windows. Otherwise, icon in exe yields virus warnings.
- Create your env (.kivy) and activate it
python -m venv .kivy
.kivy\Scripts\activate
- Get pip install script from and install
python get-pip.py
- Install kivy
pip install kivy
- Update pyinstaller and additional libs
pip install kivy.deps.sdl2
pip install kivy.deps.glew
pip install kivy.deps.angle
pip install --upgrade pyinstaller
pip install pyenchant
pip install setuptools==44.0.0
#or pip install --upgrade 'setuptools<45.0.0'
pip install Cython==0.29.10
pip install pypiwin32
-
Install your required libs
-
Create pyinstaller spec file
python -m PyInstaller --name theapp main.py
- Edit spec file
- Build package
python -m PyInstaller theapp.spec
pyinstaller theapp.spec
- Delete critical source code if they remain in app
del dist\theapp\my.py
-
Install Inno
-
Set Program Files (x86 for 64 bit) as Installation Dir
DefaultDirName={pf}\{#MyAppName}
- Enable installation privilege selection
PrivilegesRequiredOverridesAllowed=commandline dialog
- You can use the same created theapp.iss file again.
-
You should have a Microsoft Developer account. If not, create.
-
Get Package Information from the application submission you created at.
-
Open MSIX and select the setup file you created with Inno.
-
Enter package information
-- Package name:
-- Package display name:
-- Publisher name:
-- Publisher display name:
-- Version:
-- Package Description:
-- Signing preference: Do not sign
-- Installation Location: Program Files(x86)
- Open manifest file at last page by selecting Package editor
-- Change Manifest File or Edit from Capabilities Menu
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.18335.0" />
</Dependencies>
<Capabilities>
<uap:Capability Name="picturesLibrary" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
Install Windows 10 SDK. Use Windows App Certification Kit to validate your MSIX package. In case of problems analyze its report.
- OpenGL version 1.1 on remote window 10 virtual machine
- To build pyinstaller package in .spec file
# to build package in azure vm (no opengl >2.0 so use opengl es)
import os
os.environ['KIVY_GL_BACKEND'] = 'angle_sdl2'