What’s the correct process to install and run a .py application and its dependencies? Where should I save the .py file, where should I run it from, and can it interfere with the rest of my system?

Often there is an application/script I’d like to use and it is provided as a .py file download, along with a list of other applications/scripts that need to be installed separately for it to work. Often not all of these dependencies are available in my distro’s repository. There seems to be an assumption of prior knowledge as to how to get set up to run .py files, and it is therefore not documented on developers pages. Can anyone fill me in?

I’d like to install this application. Perhaps it could be used as an example to help explain the process.

My distro is Debian 13, in case that’s relevant.

Thanks!

  • residentoflaniakea@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    11
    ·
    edit-2
    10 hours ago

    You can run it in an virtual environment:

    python -m venv someproject

    source someproject/bin/activate

    Then you can run the commands in the git README you posted.

    pip …

    Will will install the include files needed within this virtual environment. Alternatively you can do

    apt install …

    Instead of using pip. Your python script should run within the virtual environment.

      • corsicanguppy@lemmy.ca
        link
        fedilink
        English
        arrow-up
        1
        ·
        30 minutes ago

        Apt: safest for Debian

        Pip/pipx: kids dig it. See “supply chain attack”

        You do what you want to support and maintain.

      • residentoflaniakea@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        1
        ·
        7 hours ago

        That might work but it is recommended to not install packages outside of virtual environments as it might lead to conflicts between versions across different projects.

        • IrritableOcelot@beehaw.org
          link
          fedilink
          arrow-up
          1
          ·
          4 hours ago

          Just FYI, pipx does use a virtual environment behind the scenes. The idea with pipx or uvx is to install a python script as a standalone script.