View previous topic :: View next topic |
Author |
Message |
blochl n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 28 Aug 2018 Posts: 18
|
Posted: Wed Aug 21, 2024 6:29 am Post subject: [solved] Best way to build a standalone Python executable? |
|
|
Hi,
I'm trying to build a standalone executable from a complex Python project (complex in the sense that it consists of multiple Python scripts, and .so files, compiled as a Python C extension). I want it to run independently of the Python version and of the local libraries on the system.
I see a lot of options: PyInstaller, PyOxidizer, Nukita, to name a few.
My question is: which tool or approach is considered to be the best practice for this nowadays?
Thanks!
Last edited by blochl on Mon Aug 26, 2024 2:32 pm; edited 1 time in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Genone Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/21004157514287ab2b29021.jpg)
Joined: 14 Mar 2003 Posts: 9592 Location: beyond the rim
|
Posted: Wed Aug 21, 2024 6:26 pm Post subject: |
|
|
Start with checking which of these is actually still maintained and officially supports current python version. For example PyOxidizer did not have a release for over 18 months now, which is an indicator that it is probably abandoned and a dead end. Then obviously you'll need to check which tool is actually compatible with your project and all its dependencies. These things usually have some restrictions and/or require modifications to your codebase to work as intended. Also check the design of the different tools, e.g. Nuitka works very different than PyInstaller and each approach has its own ups and downs.
You mention that your project consists of multiple python scripts. Are these actual scripts to be executed by the user via commandline/UI, or modules loaded by a single main application? The mentioned tools usually are designed for the second use case, the first case will likely require quite a bit more work.
TL;DR: There is no single "best" approach. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
blochl n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 28 Aug 2018 Posts: 18
|
Posted: Mon Aug 26, 2024 2:38 pm Post subject: |
|
|
Thanks!
Eventually ended up using Nuitka:
Tried PyInstaller, because it seems to be the most used, but the resulting binary had some module import issues. Then tried Nuitka, and it just worked! PyOxidizer seems to be not actively maintained indeed.
P.S. The project is indeed one executable script. All the others are modules loaded by the main application. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|