• Uncategorized

About python : How-should-I-package-a-PyInstaller-onedir-app-for-Linux

Question Detail

For various reasons, I need to package a PyInstaller app in a “onedir” format (instead of the “onefile” format). The app works well and I can launch it by going into the “onedir” directory and typing ./myapp from the terminal. My question is how should I package this folder in a way that allows (possily novice) Linux users to easily launch the app?

On Windows, I can build a nice installer or I can distribute the directory as a zip file. In both cases, the user gets a exe with a branded icon that they can double click to launch the app with. (In the portable app case, they unzip the directory and inside they will see the obvious .exe file with the branded icon). On MacOS, the “onedir” option creates a bundle that again has a branded icon that can be double clicked to start.

What should I do on Linux? (I don’t want to rely on the user knowing how to navigate into the folder, launch a terminal, and then run the ./myapp command.)

A few notes:

  1. I have considered just compressing the folder and distributing that. But, on Linux Mint, the “myapp” execuable looks like a text file and so is not easily recognizable as an executable. Also, if a user double clicks the “myapp” icon, they get an “Unknown file type” warning. The “Choose a program” dialog shows various apps but they get no “Run” option. Interestingly, if I name the executable “myapp.sh”, double clicking on it will then produce a different dialog, where they get an option to run it.

  2. The best approach is perhaps to build a deb package from the “onedir” directory. I tried this but I don’t know how to probably build the package so that the executable appears in an obvous place and can be double clicked to start. Many tutorials talk about building packages for binaries, but they don’t mention how the user is supposed to launch the executable once it is installed. Also, they often discuss single file executables, but not an executable that is in a folder (as in the case on the “onedir” option of PyInstaller).

Any advice or suggestions would be extremely helpful. Thank you!

Question Answer

Try to search how to create an AppImage or try using Mojosetup (docs)

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.