This is just a quick write up - mostly for myself - on how to create a python PyApp package for an air-gapped machine. This means that all dependencies, etc., will be included.
- Download the CPython version that should be used. A list of default versions are in
build.rsof PyApp- Linux default: 3.12.3, linux, x86_64, gnu, v3
- Windows default: 3.12.3, x84_64, msvc
- Unpack the distribution
- Install the dependencies that you want to install with
pip. Use thepipthat is inpython/bin/pip- Make sure that pip is run as
./pip install ..., i.e., use the right local one...
- Make sure that pip is run as
- If wanted, make sure that the deps are now in the
site-packagesfolder - Package again to a
tar.gzfile
Below example shows how I did this for the cowsay example on the PyApp docs website.
The environmental variables can easily be set with this python script and then run.
We want to embed, the PYAPP_DISTRIBUTION_PATH gives the path to the packaged cpython
and the PYAPP_DISTRIBUTION_PYTHON_PATH gives the relative folder inside the archive.
Also put PYAPP_SKIP_INSTALL, this will avoid pulling anything from pip.