Hack_Hut
Hack_Hut

Reputation: 184

Creating cross platform self contained python environments?

I would like to develop some Python3.6 software. The problem is that the software would run on hundreds of uniquely configured build environments that may or may not have python installed and do not have access to the internet or pypi. The machine are a mix between windows and Suse. It's important not to mess with the build environment so I would like to package my software with a isolated python environment with all the dependencies.

I'm finding it difficult to find a solution that would meet my criteria.

I've come across python virtual environments but they do not have an interpreter and are not really intended to copied around.

Another person on stack overflow recommend PEX, this looks perfect but does not seem to be compatible with Windows.

I also have thought about making the software a statically linked binary, using Cython. But again to my knowledge this still requires the correct python to be installed and has to use pure Python.

Upvotes: 1

Views: 1066

Answers (1)

Nickolay
Nickolay

Reputation: 32063

https://pyoxidizer.readthedocs.io/en/latest/comparisons.html has a comparison of various solutions in this space. It looks that if you need a cross-platform solution that doesn't require the target systems to be pre-configured (e.g. with a particular version of python pre-installed), your options are PyInstaller, PyOxidizer and Docker.

PyInstaller is more established, while PyOxidizer claims to have faster startup.

I'd expect Docker to be the least problematic if you have complex dependencies. It must be preinstalled on the target systems, but the build environments will probably have it already installed. Obviously it comes with more overhead.

Upvotes: 2

Related Questions