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!

  • emb@lemmy.world
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    edit-2
    9 hours ago

    If you actually just download a .py file, you need to run it with python. Like in the example you linked, something like

    python3 _filename_
    

    (and if that’s the case, you might need to add a line at the top of the file, telling it where the interpreter is. But probably you actually want the following)

    To install, you use the python installer program, pip. Something like

    pip _package-name_
    

    Before you do either, you need to install python and pip. I don’t know exactly (look for correct package names), but you need to run something like

    sudo apt install python3 pip
    
    • infeeeee@lemmy.zip
      link
      fedilink
      arrow-up
      7
      ·
      9 hours ago

      No, pip is for libraries, and for running scripts in virtual environments (venv). Recent versions of pip don’t work outside venvs. For installing packages systemwide use something like pipx, which creates venvs automagically and runs the script there.