I would like to run a python script with conflicts with the use of a certain graphical framework:

ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'qt5' is currently running

Therefore I would like to ask if there is a way to determine all processes that are currently using qt5 and depending on the result kill those process, so that I can run my script. (The script worked before the qt5 issue just fine - no idea by which application this new issue was caused).

  • You can use lsof to find processes that use a certain file. If you know which files are involved in "using qt5" than you can check these.
    – Lucas
    Commented Oct 21, 2020 at 20:11
  • @Lucas is there a way to do it when I only have the information from the error message to determine why/for which applications qt5 is running and how to stop qt5? (There seems to be no process called qt5 or similar - at least htop doesn't provide any results to me)
    – baxbear
    Commented Oct 21, 2020 at 21:09
  • You ask your package manager about all installed packages that have anything to do with qt5. Then ask the package manager about all installed packages that use these (recursively). Then list all files of all these packages. (Maybe only executable files?) Check against that list.
    – Lucas
    Commented Oct 21, 2020 at 22:14

1 Answer 1


This finds the first 5 pids on my machine using libnss_files-2.23.so.

$ for p in /proc/[0-9]*
    do test -d $p/map_files && 
    sudo ls -l $p/map_files | 
        awk -vpid=$(basename  $p) -vname=libnss_files-2.23.so -F '->' \
            '$2 ~ name {print pid; exit}'
  done |
  head -5 

These days on Linux, find all pids with property X is frequently solved with procfs.

  • Does libnss_files have anything to do with qt5? Or is there some file that will probably be used by a process using qt5?
    – Lucas
    Commented Oct 21, 2020 at 22:15
  • 1
    The library I chose was arbitrary; I don't use Qt. ISTM likely that all programs running under Qt will be linked to some runtime support library. If the OP finds one likely candidate, the above script can serve as a basis for searching the process tree in the way he wants. Commented Oct 22, 2020 at 22:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .