so I have a kind of pretty special problem.
I want to bundle an application, for Windows for now. PyInstaller seems best so far. BUT when delivering the bundle, a persistent venv shall be created by it AND used thereafter when executing the .exe of the bundle. So when making calls the .exe should refer to the env. The use of the env is so the user can install own libs that are the available to the application. An important point is that Python cannot be installed natively on the system itself.
Is that possible somehow? Are there tools for that?
Creating an env was tried in these ways so far:
- Using the EnvBuilder class of venv and, separately, its convenience method venv.create https://docs.python.org/3/library/venv.html#an-example-of-extending-envbuilder Unfortunately the env can be created out of the installer, i.e. a bundled application script, but the environment is somehow incomplete, it's lacking a bin directory (which might be on purpose ?) But when installing packages the install succeeds but the packages don't land in the venv's site packages dir. The install passes without error though.
- Creating an env via command line (subprocess.Popen(["python", "-m", "venv", "bla"])) can't be done since it requires python to be installed on the system. Because of this the first way also fails when calling it with with_pip=True
So the lines are
env_dir = "C:\\Users\\Tester\\pyinstaller_venv"
### class from the doc example
builder = ExtendedEnvBuilder()
builder.create(env_dir)
# ensurepip.bootstrap(root=env_dir)
##### wrapper
venv.create(env_dir)
#### cmd
subprocess.Popen(["python3", "-m", "venv", env_dir])
Help appreciated.