This is an example of how to convert a streamlit app from Linux or Windows to an executable for Windows (.exe). To do this, we use the pynsist
package.
Demo based on takluyver/pynsist.
- Clone this repo
- Launch the development container or install the dependencies and
NSIS
in your environment. - Run
streamlit run src/app.py
to launch the app. - Run
pynsist installer.cfg
to build the executable (The app do not need to be running). - Double-click
build\nsis\Windows_Streamlit_App_0.1.0.exe
to launch the executable in Windows.
NSIS is a tool for creating Windows installers. It is used by pynsist to create the installer for the application.
You can install NSIS by downloading the installer from the NSIS website.
You can install NSIS using your package manager. For example, on Ubuntu:
sudo apt update
sudo apt install nsis
You have to add the dependencies to the installer.cfg
file in order to be included in the executable. You can do this by adding the dependencies to the pypi_wheels
section. You can use the output of pip freeze
and then run:
pynsist installer.cfg
This command will create a build
folder with the executable. If any dependencies are not found in the PyPI
repository, you will get an error like:
nsist.wheels.NoWheelError: No compatible wheels found for validators 0.20.0
To avoid this, you can download the wheels manually and put them in the wheels
folder.
pip wheel --wheel-dir wheels/ validators==0.20.0
- Demo based on takluyver/pynsist
- Pynsist