hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9.3K
active users

Looking for ways to install programs on 11 and 12 systems, globally (as would normally be in /usr/local/bin/ for executables, elsewhere in /usr/local/ for additional files), to run periodically or as daemons (later setting systemd services for those). "Easy install" is deprecated, pip points at the externally managed environment and wants a virtual environment, pipx also installs into a venv in the user's home directory. Executable scripts are available to other users then, but sitting in a user directory, which is unconventional, contrary to the FHS. Packaging into .deb must be possible, apparently using dh-python, though so far I have not found a complete guide to follow, possibly will have to dig deeper into it. Single-file scripts could be simply copied into /usr/local/bin/, but there can be multi-file programs as well. I wonder whether I am missing something: this looks surprisingly tricky for such a task, with a very popular language and a popular Linux distribution. How do you package and install custom Python programs on Debian?

@defanor what I ended up doing is creating a directory in `/opt`, install as many deps as possible using the OS' packages (for better security coverage), create a venv there that uses the system packages, and run stuff from there.

@mdione Combining those with system packages sounds like a potentially nice compromise; the lack of centralized updates is one of my concerns about use of venvs, too. Going to try packaging into deb (which worked for a test package now, as mentioned in nearby replies), but this combination of /opt/ with system packages looks like an okay backup option. Thanks.

@defanor @mdione It's worth noting that if you rely on the system package manager to install your Python dependencies, you might be getting pretty out-of-date versions for some of them. Depends on the distro and the package of course, but I've seen Ubuntu packages months out of date in apt, even on the latest Ubuntu release. So you gotta consider the tradeoff between convenience and security, as always.

@diazona @defanor TBH, 'months old' is not a problem for me. Very rarely I need a newer version because the feature I want to use is only there. But then, I tend to work on environments that prefer stability and security than go fast and break things.

defanor

@mdione @diazona Same here, and it applies to pretty much all the software from Debian stable and oldstable (as mentioned above) repositories, not just Python packages. But it generally works for me even if a version is years old, especially if security patches are applied.