Skip to content

Commit

Permalink
Update win_exe_with_embeddable_python.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Arslan-Siraj authored May 6, 2024
1 parent 7051c64 commit 431188e
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions win_exe_with_embeddable_python.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Creating a Windows Executable of a Streamlit App with Embeddable Python
## 🚀 Creating a Windows Executable of a Streamlit App with Embeddable Python

To create an executable for Streamlit app on Windows, we'll use an embeddable version of Python.</br>
To create an executable for your Streamlit app on Windows, we'll use an embeddable version of Python.</br>
Here's a step-by-step guide:

### Download and Extract Python Embeddable Version
### 📥 Download and Extract Python Embeddable Version

1. Download a suitable Python embeddable version. For example, let's download Python 3.11.9:

Expand All @@ -17,7 +17,7 @@ Here's a step-by-step guide:
unzip python-3.11.9-embed-amd64.zip
```

### Install pip
### 🛠 Install pip

1. Download `get-pip.py`:

Expand All @@ -31,7 +31,7 @@ Here's a step-by-step guide:
./python-3.11.9-embed-amd64/python <path_to_get-pip.py> --no-warn-script-location
```

### Configure Python Environment
### Configure Python Environment

1. Uncomment 'import site' in the `python311._pth` file:

Expand All @@ -44,15 +44,15 @@ Here's a step-by-step guide:
sed -i 's/^# import site/import site/' python-3.11.9-embed-amd64/python311._pth
```

### Install Required Packages
### 📦 Install Required Packages

Install all required packages from `requirements.txt`:

```bash
./python-3.11.9-embed-amd64/python -m pip install -r requirements.txt --no-warn-script-location
```

### Copy App Files
### 📂 Copy App Files and Create `run_app.bat` File

1. Create a folder for your Streamlit app:

Expand All @@ -64,20 +64,19 @@ Install all required packages from `requirements.txt`:

```bash
# Copy Python environment and app files
cp -r python-3.11.9-embed-amd64 streamlit_exe \
&& cp -r src ../streamlit_exe \
&& cp -r pages ../streamlit_exe \
&& cp -r .streamlit ../streamlit_exe \
&& cp -r example_data ../streamlit_exe \
&& cp app.py ../streamlit_exe
cp -r python-3.11.9-embed-amd64 streamlit_exe
cp -r src pages .streamlit example_data app.py ../streamlit_exe
```

### Create a Clickable Shortcut

Create a `run_app.bat` file to make running the app easier:

```batch
@echo off
.\python-3.11.9-embed-amd64\python -m streamlit run app.py local
```

3. Create a Clickable Shortcut

Create a `run_app.bat` file to make running the app easier:

```batch
@echo off
.\python-3.11.9-embed-amd64\python -m streamlit run app.py local
```
##### 🚀 <code> After successfully completing all these steps, the Streamlit app will be available by running the run_app.bat file.</code>
> [!NOTE]
You can still change the configuration of Streamlit app with .streamlit/config.toml file, e.g., provide a different port, change upload size, etc.

0 comments on commit 431188e

Please sign in to comment.