Vlad
Vlad

Reputation: 1919

Deploying a pre-built embedded Python environment on Windows

I'm looking at setting up a completely self-contained Python environment which will get carried (or downloaded) by my .NET app installer. This Python environment will be used via pythonnet to execute Python code from a .NET app context. The requirement is that this should work for all Windows 10 end-users whether or not they have a local installation of Python or any VS build tools.

What I have working so far: Similar to the Python.Included project, I carry a minimal embedded python environment which already has a script to setup pip and tcl libraries. This python envrionment will be deployed to the user's AppData folder if it's not already there and then it will run a bunch of pip install commands to get a few dependencies (pythonnet, numpy, scipy, pandas).

The problem: The setup above works for the listed packages above but starts failing for some users when trying to install a different pip package which also generates an .exe during the install (the package is pyprophet). On my development machine, this installation is successful, however for some users, this part fails and the final .exe is not generated.

My thought is that some systems are missing some build tools so the final .exe generation fails. I'm looking for suggestions on how to ensure this .exe is going to be there for all users. An idea is to just setup everything on my side (including all the pip commands) and just let the user's machine download it and place it in AppData, but it's pretty big (~1GB). Plus, I'm not yet sure the final .exe will work if it's pre-packaged like this. I would definitely prefer a solution where the initial python environment is minimal as is now and then let it do its own pip installs on demand when certain modules are needed.

Upvotes: 0

Views: 296

Answers (1)

LOST
LOST

Reputation: 3250

Unfortunately, packaging the entire environment with minimal cleanup is the only way I could come up with so far.

Please, see my PackagedTensorflow project for a packing script example using conda. You are right, there is no guarantee it will work, but I have not seen any issues so far at least with TensorFlow.

Compressed package is only about 170MB, but it expands to nearly 1GB during installation, most of which is TensorFlow binaries.

Upvotes: 1

Related Questions