• Distributing program for Linux

    From Loris Bennett@21:1/5 to All on Tue Mar 14 16:43:14 2023
    Hi,

    If I write a system program which has Python >= 3.y as a dependency,
    what are the options for someone whose Linux distribution provides
    Python 3.x, where x < y?

    I am aware that an individual user could use (mini)conda to install a
    more recent version of Python in his/her home directory, but I am
    interested in how root would install such a program.

    Cheers,

    Loris

    --
    This signature is currently under constuction.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Ward@21:1/5 to Loris Bennett on Tue Mar 14 17:15:30 2023
    On Tue, Mar 14, 2023 at 04:43:14PM +0100, Loris Bennett wrote:
    If I write a system program which has Python >= 3.y as a dependency,
    what are the options for someone whose Linux distribution provides
    Python 3.x, where x < y?

    The docs suggest creating your own package or building and installing
    from source:
    https://docs.python.org/3/using/unix.html

    To install from source, use ‘make altinstall’ (instead of ‘make install’) to avoid shadowing your system Python version. The alternative interpreter should be qualified with <major>.<minor> version, e.g.
    python3.11

    Depending on the package manager used by the distribution,
    ‘checkinstall’ could be used to build from source and install as a
    package without rolling your own.
    https://wiki.debian.org/CheckInstall

    On Ubuntu check out the deadsnakes PPA: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa

    Or use python-build from pyenv to install to a custom location: https://github.com/pyenv/pyenv/wiki/Common-build-problems#installing-a-system-wide-python

    Simon

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Weatherby,Gerard@21:1/5 to All on Tue Mar 14 23:28:18 2023
    It�s really going to depend on the distribution and whether you have root access.

    If you have Ubuntu and root access, you can add the deadsnakes repo, https://launchpad.net/~deadsnakes, and install whatever Python you want.

    The default �python3� remains but you can called a specific Python, (e.g. python3.10).

    A typical shebang line would be:

    #!/usr/bin/env python3.10

    From: Python-list <python-list-bounces+gweatherby=[email protected]> on behalf of Loris Bennett <[email protected]>
    Date: Tuesday, March 14, 2023 at 12:27 PM
    To: [email protected] <[email protected]>
    Subject: Distributing program for Linux
    *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

    Hi,

    If I write a system program which has Python >= 3.y as a dependency,
    what are the options for someone whose Linux distribution provides
    Python 3.x, where x < y?

    I am aware that an individual user could use (mini)conda to install a
    more recent version of Python in his/her home directory, but I am
    interested in how root would install such a program.

    Cheers,

    Loris

    --
    This signature is currently under constuction.
    -- https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!l02A4qczH46l1ScA8yisiIwlDKh96sy16woPSOSABWqym4b6dBtHzExfFwZsnPDezDwDqaM0fdCMs3080WQQZ-b5OghOOpI$<https://urldefense.com/v3/__https:/mail.python.org/mailman/
    listinfo/python-list__;!!Cn_UX_p3!l02A4qczH46l1ScA8yisiIwlDKh96sy16woPSOSABWqym4b6dBtHzExfFwZsnPDezDwDqaM0fdCMs3080WQQZ-b5OghOOpI$>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Loris Bennett@21:1/5 to Gerard" on Wed Mar 15 08:37:18 2023
    "Weatherby,Gerard" <[email protected]> writes:

    It’s really going to depend on the distribution and whether you have root access.

    I am interested in providing a package for people with root access for a variety of distributions.

    If you have Ubuntu and root access, you can add the deadsnakes repo, https://launchpad.net/~deadsnakes, and install whatever Python you
    want.

    I myself have this part covered via EasyBuild, https://easybuild.io/,
    which will work on any distro. How anybody else installs a given
    version Python will be left as an exercise for them (potential users of
    the software are however unlikely to be using Ubuntu).

    The default ‘python3’ remains but you can called a specific Python, (e.g. python3.10).

    A typical shebang line would be:

    #!/usr/bin/env python3.10

    I am currently using poetry to build the package and uses a 'scripts'
    section in the pyproject.toml file to produce stubs to call the main
    program. These have the shebang

    #!/usr/bin/python3

    So if I can get poetry to use '/usr/bin/env' instead, then I can
    probably just rely on whatever mechanism other people use to switch
    between Python versions to do the right thing.

    Cheers,

    Loris

    From: Python-list <python-list-bounces+gweatherby=[email protected]>
    on behalf of Loris Bennett <[email protected]>
    Date: Tuesday, March 14, 2023 at 12:27 PM
    To: [email protected] <[email protected]>
    Subject: Distributing program for Linux
    *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

    Hi,

    If I write a system program which has Python >= 3.y as a dependency,
    what are the options for someone whose Linux distribution provides
    Python 3.x, where x < y?

    I am aware that an individual user could use (mini)conda to install a
    more recent version of Python in his/her home directory, but I am
    interested in how root would install such a program.

    Cheers,

    Loris

    --
    This signature is currently under constuction.
    -- https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!l02A4qczH46l1ScA8yisiIwlDKh96sy16woPSOSABWqym4b6dBtHzExfFwZsnPDezDwDqaM0fdCMs3080WQQZ-b5OghOOpI$<https://urldefense.com/v3/__https:/mail.python.org/mailman/
    listinfo/python-list__;!!Cn_UX_p3!l02A4qczH46l1ScA8yisiIwlDKh96sy16woPSOSABWqym4b6dBtHzExfFwZsnPDezDwDqaM0fdCMs3080WQQZ-b5OghOOpI$>
    --
    Dr. Loris Bennett (Herr/Mr)
    ZEDAT, Freie Universität Berlin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anssi Saari@21:1/5 to Loris Bennett on Wed Mar 15 13:02:29 2023
    "Loris Bennett" <[email protected]> writes:

    I am aware that an individual user could use (mini)conda to install a
    more recent version of Python in his/her home directory, but I am
    interested in how root would install such a program.

    Root would install the script and required Python version somewhere
    depending any site specific practices and then use things like pyenv,
    stow, environment modules or whatever to give the users access to it.

    Root might even package your script with the interpreter required into
    one binary. See Tools/freeze in the source distribution.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Loris Bennett@21:1/5 to Anssi Saari on Wed Mar 15 13:27:25 2023
    Anssi Saari <[email protected]> writes:

    "Loris Bennett" <[email protected]> writes:

    I am aware that an individual user could use (mini)conda to install a
    more recent version of Python in his/her home directory, but I am
    interested in how root would install such a program.

    Root would install the script and required Python version somewhere
    depending any site specific practices and then use things like pyenv,
    stow, environment modules or whatever to give the users access to it.

    The program is not for normal users, but is a system program. Many
    admins who might install the program will be using environment modules,
    so that, coupled with setting

    #!/usr/bin/env python3

    for the scripts, looks like it might be a reasonable solution.

    Root might even package your script with the interpreter required into
    one binary. See Tools/freeze in the source distribution.

    Well, anyone who has the sources can do that, if so inclined.
    Personally, I already have enough versions of Python (currently 12
    versions installed via EasyBuild plus the 2 from the OS itself) without creating fat binaries which contain a copy of one of those version.

    Cheers,

    Loris

    --
    This signature is currently under constuction.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)