Skip to content

Commit 209507a

Browse files
committed
docs: add instructions to build pyInstaller binaries locally
Signed-off-by: Stephen L. <LRQ3000@gmail.com>
1 parent e932cdd commit 209507a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

pyInstallerInstructions.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Instructions to build a standalone exe using pyInstaller:
2+
3+
1. Install Anaconda or Miniconda3.
4+
2. Launch the Anaconda/Miniconda3 command prompt, or just a standard terminal if conda is in the PATH.
5+
3. conda create -n webactogramenv python=3.10
6+
Note: you can change the python version when a newer interpreter will be released. Creating a new venv is necessary to limit the number of packages in the environment, so that pyinstaller does not include a whole lot of unnecessary packages.
7+
4. conda activate webactogramenv
8+
5. pip install --upgrade webactogram
9+
Note: webactogram needs to be up-to-date on pypi, otherwise replace this command by `pip install -e .` to use the local version.
10+
Note2: if trying to compile for another platform such as 32-bits, then it may be better to install from local machine instead of from pypi, which can be done with: `pip.exe install -e .` without the ticks.
11+
6. pip install --upgrade pyinstaller
12+
13+
From this step on, you can reuse the same environment each time you want to rebuild the freezed binary (as long as you install nothing else but the strictly necessary packages to run your project, as to keep it clean and with minimal dependencies):
14+
7. cd to the webactogram subfolder (the module one, where webactogram.py resides)
15+
8. conda activate webactogramenv
16+
9. if there is any dist or build or __pycache folder, delete them
17+
10. pyinstaller -D -c --hidden-import="pkg_resources.py2_warn" --hidden-import="pkg_resources.py3_warn" --add-data="_version.py;." webactogram.py
18+
Note: we used to bundle as one-file (with -F option), but in newer versions, the python app is unpackaged in a random temporary folder, which makes it difficult to bundle config files that are easily accessible and modifiable by the user. And also such apps are slower to launch than one-folder bundles. So we now bundle as a one-folder, using the -D option. We also force the console to stay open with the -c argument as it gives additional infos to the user, especially in case of errors.
19+
11. Copy config.ini and config_internal.ini in the dist/webactogram folder
20+
12. Zip the dist/webactogram folder and distribute it.
21+
22+
To build a 32-bit binary, simply install Miniconda3 32-bit and repeat the steps above with the 32-bit interpreter.

0 commit comments

Comments
 (0)