(Real) Self-contained Python Environments
Without reinventing the wheel :)
I recently faced an interesting use case: develop a Python project with the latest Python and modern libraries running on a machine with no Python runtime.
(To be fair, the machines contained Python, but old versions were irrelevant to the project, so I’m generalizing this blog post to generic use cases in favor of our readers.)
The first reaction to the word “self-contained” in most use cases is often: “Let’s containerize the application”. However, containerization presupposes that the runtime machine can run containers, ie, has a container runtime installed on it. Another “Pythonic” solution for self-contained applications would be to use conda
. Again, it assumes the target machine has conda
installed on it.
The leading constraint is that we must be able to run the project without installing “prerequisite” software on the target machine, other than uploading the project itself.
So, let’s define the two main objectives of this blog post:
- Run a self-contained Python application only by uploading it to the target machines.
- Strive to achieve goal 1 with the…