How to Create an MSI installer for a Python Application

Written by Alex Marin · February 13th, 2024 · 4min read

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 installer for your Python application, using the free edition of Advanced Installer. It will take us only 5 steps! Plus, we have a video at the end of the article were we present the entire process in an easy-to-follow way.

Before diving into our quick guide on packaging a Python application and creating an MSI, 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.

NoteThe 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.

Python dependencies dlls

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).

Convert python script to exe

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.

Advanced installer project type

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”.

Files and folder page

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.

New file shortcut

Once all of our files and shortcuts are created, we can build the Python MSI installer 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.

NoteIn case you need an installer built with the new MSIX technology, we covered it for you: Create an MSIX for your Python app

Video Tutorial

Conclusion

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.

NoteCX_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.

FAQs

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.

Comments: