How to Create an MSI for a Python Application
As one of the most prominent programming languages in the world, Python is supported by many tools and modules. It is easy to learn and provides a nicely constructed code -- which opens the door for many solutions and endless possibilities.
In this particular article, we will go through creating an MSI for your Python application, using the free edition of Advanced Installer. It will take us only 5 steps!
Before diving into our quick guide on creating an MSI for a Python application, let's address the process of converting Python into Exe.
How to Convert Python into Exe
In the past, it was required for a user to have Python installed in order to run a Python script, but nowadays there are many Python to exe converters in the market.
The most popular ones are PyInstaller , or Auto Pi to EXE, which is basically a graphical user interface for PyInstaller.
When a Python script is converted into an EXE, all of the necessary Python dependencies and dll’s are added, either in one big exe file, or alongside the executable.
These converters ensure the developers that no matter where the script is executed, all of the necessary Python files will be present on the machine -- to make the script execute successfully.
If you want to read or refresh on how to deploy a Python script, you can check our post about it -- but, now let’s have a look at how easy it is to create an MSI for a converted Python script.
How to Create an MSI for your Python executable
For this example, we converted a simple helloworld Python script to exe using the Auto PI to EXE converter. We also chose to leave all of the python files uncompressed (this doesn’t affect our Advanced Installer project).
Now that you have your Python executable follow these steps:
1. Open Advanced Installer. You will be presented with a dialog window where you can choose the type of project you want to create.
2. Select the “Simple” type.
3. Uncheck the “Use wizard...” option.
4. Press the [ Create Project ] button.
5. Your new project has been created, which means you can now edit it.
Once the project is opened, navigate to the Files and Folders Page. There, you will be able to choose where to install your files. In our case, we added all the files to “Program Files\My Python Application”.
If you want to add a shortcut to your executable (in our case helloworld.exe), select your executable, and press “New Shortcut To” from the upper left corner, then select “Installed File”.
A new window will appear where you can configure your shortcut name, icon, etc. For more information about shortcuts see our Creating Shortcuts in the Files and Folders Page.
Once all of our files and shortcuts are created, we can build the MSI by clicking on Build in the upper left corner.
And that is it, in a few simple clicks you have your Python application ready for deployment.
Video Tutorial - create an MSI for your Python application
Advanced Installer offers quick solutions for multiple Python scenarios, whether you want to "wrap up" your Python script, or if you are using tools to convert your Python script to EXE.
You could also convert your Python script to EXE and automatically create an MSI installer for it with cx_freeze . You can read more about this tool here: Create a Python executable and MSI installer using Cx_freeze.
CX_Freeze reminds me of WiX, because the MSI must be created programmatically.
As always, we hope you found this article useful, let us know your own tips and tricks in the comments.
How to Create an MSI for a Python Application: FAQ
How do I create an MSI installer for a Python application?
An MSI installation file for a Python application can be created with a Windows Installer Tool. In this article we prepared a tutorial for creating an MSI installer from a Python executable with the help of Advanced Installer.
How do I make a Python executable?
A Python script can be converted into an executable with the help of a Python to EXE converter like Pyinstaller or Auto Pi to EXE, which ensures that all the files and DLLs are added into the EXE file. This way, no matter where the script is executed, it will be executed successfully. You can then take one step further and package the new Python EXE into an MSI installer, to easily distribute it to other users.
Subscribe to Our Newsletter
Sign up for free and be the first to receive the latest news, videos, exclusive How-Tos, and guides from Advanced Installer.