I want to use the option to embed Python in my scripts to have (more or less) standalone executable. Consider the following example
```app.py
"""Sample app with complicated dependencies."""
import numpy as np
def main():
rng = np.random.default_rng()
print("A random number: ", rng.integers(100))
```
```setup.py
from Cython.Build import BuildExecutable
from Cython.Compiler import Options
# should be after Cython
from setuptools import setup
Options.embed = "main"
BuildExecutable.build("app.py")
setup(
name="embedded",
py_modules=[],
ext_modules=[],
entry_points={
"console_scripts": [
"random = app:main",
]
},
)
```
To run the setup script, I need to have a static library of Python, which I get using `conda install libpython-static`.
But still, `pip install .` yields the following error:
lto1: fatal error: bytecode stream in file ‘${HOME}/mambaforge/lib/libpython3
.10.a’ generated with LTO version 12.0 instead of the expected 11.3
compilation terminated.
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
${HOME}/mambaforge/compiler_compat/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
The `--embed` option is sadly not very well document. Has anyone experience, how to correctly do it?