Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: Aladin on May 21, 2020, 02:20:09 AM

Title: Standalone executable file
Post by: Aladin on May 21, 2020, 02:20:09 AM
Hello all! I'm writing a Python program that uses a lot of dependencies and Python libraries. How can I convert this Python file into one standalone executable file that can run on PiCore 10.0 Beta? This way I can distribute my program to anyone that has a rpi and run it without having to install any other required files. For example on Windows I use PyInstaller to create a .exe file that I am able to run on any computer.
Title: Re: Standalone executable file
Post by: Juanito on May 21, 2020, 02:46:08 AM
You could make one large extension?

btw - piCore-10.x is not actively maintained, you might be better off using the latest release, piCore-9.x, or the latest beta, piCore-11.x.
Title: Re: Standalone executable file
Post by: jazzbiker on May 21, 2020, 02:52:56 AM
Hello all! I'm writing a Python program that uses a lot of dependencies and Python libraries. How can I convert this Python file into one standalone executable file that can run on PiCore 10.0 Beta? This way I can distribute my program to anyone that has a rpi and run it without having to install any other required files. For example on Windows I use PyInstaller to create a .exe file that I am able to run on any computer.

On any computer running Windows )
Title: Re: Standalone executable file
Post by: Aladin on May 21, 2020, 05:45:32 AM
Hello all! I'm writing a Python program that uses a lot of dependencies and Python libraries. How can I convert this Python file into one standalone executable file that can run on PiCore 10.0 Beta? This way I can distribute my program to anyone that has a rpi and run it without having to install any other required files. For example on Windows I use PyInstaller to create a .exe file that I am able to run on any computer.

On any computer running Windows )


i don't understand
Title: Re: Standalone executable file
Post by: Aladin on May 21, 2020, 05:46:58 AM
You could make one large extension?

btw - piCore-10.x is not actively maintained, you might be better off using the latest release, piCore-9.x, or the latest beta, piCore-11.x.

i will use piCore-9.x but i don't understand you with make one large extension
Title: Re: Standalone executable file
Post by: Juanito on May 21, 2020, 06:46:32 AM
Copy all the files you want to include to, say, /tmp/pkg preserving the directory structure and permissions and then:
Code: [Select]
$ tce-load -i squashfs-tools
$ cd /tmp
$ sudo mksquashfs pkg/ mybigextension.tcz

You can then copy mybigextension.tcz to /mnt/mmcblk0p2/tce/optional and set it to load "onboot".
Title: Re: Standalone executable file
Post by: Rich on May 21, 2020, 07:09:27 AM
Hi Aladin
... This way I can distribute my program to anyone that has a rpi and run it without having to install any other required files. ...
So it sounds like you are trying to create a self contained package that will run on any PI running any Linux.

Quote
... For example on Windows I use PyInstaller to create a .exe file that I am able to run on any computer.
From:
https://www.pyinstaller.org/
Quote
PyInstallers main advantages over similar tools are that PyInstaller works with Python 2.7 and 3.5-3.7, it builds smaller executables thanks to transparent compression, it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility.
Python versions 2.7, 3.5, and 3.6 are all available in piCore-9.x.

Quote
PyInstaller Quickstart

Install PyInstaller from PyPI:

Code: [Select]
pip install pyinstaller
Go to your programs directory and run:

Code: [Select]
pyinstaller yourprogram.py
This will generate the bundle in a subdirectory called dist.

For a more detailed walkthrough, see the manual. https://pyinstaller.readthedocs.io/
So it sounds like if you install Python and set up pip, you should be able to install pyinstaller.