How to Create an MSI installer for a Python Application

msi for python app

Written by Alex Marin · February 13, 2024

#MSI

#PYTHON

As one of the most prominent programming languages ​​in the world, Python is supported by many tools and modules. It’s easy to learn and offers beautifully constructed code — which opens the door to many solutions and endless possibilities.

In this particular article, we will go over creating an MSI installer for your Python application, using the free edition of the Advanced Installer. It will only take 5 steps! Plus, we have a video at the end of the article where we walk you through the entire process in an easy-to-follow way.

Before we dive into our quick guide to packaging a Python application and creating an MSI, let’s cover the process of converting Python to Exe.

How to convert Python to Exe

In the past, a user was required to have Python installed to run a Python script, but nowadays there are many Python to exe converters in the market.

noteThe most popular are PyInstaller, or Auto Pi in EXE, which is basically a graphical user interface for PyInstaller.

When a Python script is converted to an EXE, all necessary Python dependencies and dlls are added, either in a large exe file, or alongside the executable.

Python dependency dlls

Python dependency dlls

These converters assure developers that no matter where the script is run, all the necessary Python files will be present on the machine — to make the script run successfully.

If you want to read or refresh on how to deploy a Python script, you can check out our post about it — but for now let’s take 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 python files uncompressed (this does not affect our Advanced Installer project).

Convert python script to exe

Convert python script to exe

Now that you have your Python executable, follow these steps:

1. open Advanced installer. A dialog window will appear where you can select the type of project you want to create.

Advanced installer project type

Advanced installer project type

2. Choose “Simple”
the type.

3. Deselect e “Use the wizard…” option.

4. Press [ Create Project
]
the button.

5. Your new project is created, which means you can now edit it.

Once the project opens, 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 “Program Files\My Python Application”.

Files and folders page

Files and folders page

If you want to add a shortcut to your executable (in our case helloworld.exe), select your executable and press “New Short For” from the upper left corner, then select “Installed File”.

A new window will appear where you can configure your name, shortcut icon, etc. For more information about shortcuts, see Creating shortcuts on the Files and Folders page.

New file shortcut

New file shortcut

Once all our files and shortcuts are created, we can build the Python MSI installer by clicking on Build in the upper left corner.

And that’s 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’ve got you covered: Create an MSIX for Your Python Application

Tutorial video

CONCLUSION

The Advanced Installer provides quick solutions for many Python scripts, whether you want to “finish” your Python script, or are using tools to convert your Python script to EXE.

You can 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 an executable Python installer and MSI using Cx_freeze.

noteCX_Freeze reminds me of WiX, because the MSI has to be created programmatically.

As always, we hope you found this article useful, let us know your tips and tricks in the comments.

Frequently asked questions

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 have 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 to an executable with the help of a Python to EXE converter such as Pyinstaller or Auto Pi to EXE, which ensures that all files and DLLs are added to the EXE file. That way, no matter where the script is executed, it will execute successfully. You can then go a step further and package the new Python EXE into an MSI installer, to easily distribute to other users.

Sign up to our newsletter

Sign up for free and be the first to receive the latest news, videos, exclusive instructions and guides from Advanced Installer.

Để lại một bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

Contact Me on Zalo
Tư Vấn Miễn Phí