Questions tagged [psutil]

psutil (python system and process utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network) in Python.

psutil (process and system utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network) in Python. It is useful mainly for system monitoring, profiling and limiting process resources and management of running processes. It implements many functionalities offered by command line tools such as: ps, top, lsof, netstat, ifconfig, who, df, kill, free, nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. It currently supports Linux, Windows, OSX, Sun Solaris, FreeBSD, OpenBSD and NetBSD, both 32-bit and 64-bit architectures, with Python versions from 2.6 to 3.5.

Resources:

481 questions
2
votes
0 answers

Getting process id with process name using psutil

I am writing a custom ansible module to get process id with process name using the linux package psutil . this is my module file. from ansible.module_utils.basic import AnsibleModule import sys try: import psutil HAS_PSUTIL = True except…
2
votes
3 answers

'gcc' error when installing apache-airflow

I am working on an Oracle VirtualBox Fedora 64-bit VM with Python3.6. I have configured a venv to install apache-airflow. My pip3 is updated to 18.0, and I have installed a number of devel-tools with yum: $ yum groupinstall "Development tools" $ yum…
2
votes
2 answers

How To Tell If A Program Is Open

I'm currently automating a process that involves running Hapfacs 3.0, a C# program designed to construct facial images. I'm using python to open the program, to set some parameters, and then to save the resulting image. The automation will do this…
2
votes
1 answer

psutil windows process memory usage

My objective is simply to list the top 5 processes hogging memory, and exactly how much memory they are "using". I have read through the docs and it seems that process.memory_info().rss is what I want, however this number comes out significantly…
Spencer
  • 1,931
  • 1
  • 21
  • 44
2
votes
1 answer

module 'psutil' has no attribute 'process_iter' in python 3.5

I am using python 3.5.2 on windows10 machine and having problems running a py script. I am getting this error: 'psutil has no attribute process_iter' if either use psutil.process_iter() or psutil.process.get_list(). I have psutil 5.4.3…
danielG
  • 41
  • 1
  • 2
  • 9
2
votes
1 answer

AttributeError: 'Process' object has no attribute 'set_cpu_affinity'

I'm running joblib and having the same problem as here, it only uses 2 cores out of 8. I tried setting the CPU affinity as described here. I'm using psutil version 5.4.3. I still run into this error: AttributeError: 'Process' object has no attribute…
2
votes
1 answer

psutil.WindowsService.username() returns blank

In my Win10 machine there a few services whose display name ends in "_5e11c". Windows Services console says that all of them log on as Local System. However, for any of them psutil.WindowsService.username() gives an empty string and if I query the…
R01k
  • 735
  • 3
  • 12
  • 26
2
votes
1 answer

Why does concurrent.futures increase vms memory?

I find that when I use Python's concurrent.futures.ThreadPoolExecutor the vms memory use (as reported by psutil) increases dramatically. In [1]: import psutil In [2]: psutil.Process().memory_info().vms / 1e6 Out[2]: 360.636416 In [3]: from…
MRocklin
  • 55,641
  • 23
  • 163
  • 235
2
votes
1 answer

What is a snic in the python psutil module

I'm writing a python script with the psutil module that monitors some of the running specs of my web servers, for example cpu usage, memory usage and disk usage. One information I want to get from the script is all the ip addresses associated with…
LightBlue
  • 21
  • 2
2
votes
1 answer

How to set real time priority with psutil

How can I set real time priority with psutil. When I try this: process.nice(psutil.REALTIME_PRIORITY_CLASS) REALTIME_PRIORITY_CLASS results in HIGH_PRIORITY_CLASS.
Jakub Bláha
  • 1,491
  • 5
  • 22
  • 43
2
votes
1 answer

Creating Process Dictionary

My Goal: I need to create a function that retrieves the PID and Name of each process and returns them in a dictionary. I will be uploading this to Django and really need two different dictionaries. 1 with every running process name and PID and…
Joe
  • 2,641
  • 5
  • 22
  • 43
2
votes
0 answers

Calculate percentage of time disk is reading/writing using python

I am trying to set up some system monitoring. I want to calculate the percentage of time the disk is processing read or write requests. I am try to do this with psutil. My current solution looks like this: readtime =…
Jeff Stapleton
  • 303
  • 3
  • 9
2
votes
4 answers

psutil's cpu_percent always returns 0.0

I would like my Flask application to report how much CPU and memory it is currently using as a percentage: import psutil from flask import Flask, request, jsonify app = Flask(__name__) @app.route("/test", methods=["GET"]) def healthz(): return…
Python Novice
  • 1,980
  • 5
  • 26
  • 33
2
votes
3 answers

Python lambda function to sort list according to dictionary

The sample codes bellow retrieve all the runing procces and print them. They've bee written following the 3rd example here and final one from here. Problem is I cannot figure out why only the first one retrieves process sorted as desired. I think…
Rodrigo Remedio
  • 640
  • 6
  • 20
2
votes
2 answers

psutil: get cpu of all processes

Maybe I'm overlooking something, but I can't figure out how to get current_process.cpu_percent(interval=0.1) for all processes at once without iterating over them. Currently iteration will take process_count * interval seconds to finish. Is there a…
curiousaboutpi
  • 131
  • 1
  • 9