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
24
votes
11 answers

Error : No module named 'psutil'

I've been trying to install Peter Chervenski's MultiNEAT and ran into a problem while running setup.py (python setup.py build_ext): File "c:/Users/1234/Documents/Alex/multineat/peter-ch-MultiNEAT-f631e2f/setup.py", line 7, in from…
SeyVetch
  • 301
  • 1
  • 2
  • 7
16
votes
3 answers

How to get accurate process CPU and memory usage with python?

I am trying to create a process monitor but I am unable to get accurate results comparing my results to windows task manager. I have been using psutil which seems to work fine when looking at the overall cpu and memory usage but doesn't appear to be…
Chris
  • 987
  • 2
  • 12
  • 25
16
votes
4 answers

cpu_percent(interval=None) always returns 0 regardless of interval value PYTHON

The code always returns 0.0 values, regardless of interval values. import psutil p = psutil.Process() print p.cpu_percent(interval=1) print p.cpu_percent(interval=None)
Nihal Harish
  • 980
  • 5
  • 13
  • 31
13
votes
2 answers

Meaning of the benchmark variables in snakemake

I included a benchmark directive to some of the rules in my snakemake workflow, and the resulting files have the following header: s h:m:s max_rss max_vms max_uss max_pss io_in io_out mean_load The only documentation I've found mentions a…
bli
  • 7,549
  • 7
  • 48
  • 94
13
votes
2 answers

How to get the percentage of memory usage of a process?

Using the following code, I can get the memory consumption of a give process in MiB: def memory_usage_psutil(): # return the memory usage in MB import psutil process = psutil.Process(os.getpid()) mem = process.get_memory_info()[0] /…
B Faley
  • 17,120
  • 43
  • 133
  • 223
11
votes
1 answer

Using psutil.Process.memory_info memory usage differs from Pandas.memory_usage

I'm profiling a program that makes use of Pandas to process some CSVs. I'm using psutil's Process.memory_info to report the Virtual Memory Size (vms) and the Resident Set Size (rss) values. I'm also using Pandas DataFrame.memory_usage…
musingsole
  • 1,057
  • 1
  • 8
  • 21
11
votes
3 answers

Troubles while installing psutil (wheel) as a dependency via pip

I wrote a package with a dependency's dependency to psutil (my-package depends on third-party-package which depends on psutil). Since it's supposed to run on a server without any connectivity and without gcc, I prepared the deployment locally with a…
Anto
  • 6,806
  • 8
  • 43
  • 65
10
votes
1 answer

Is psutil.net_connections() unavailable for OSX?

I was trying to run psutil.net_connections() on my OS X (12.1) Macbook Pro in python, but was greeted with the error of syscall failed. This is weird because most of ther other functions of psutil worked fine with no issues, yet somehow…
Jeremy Chow
  • 101
  • 2
10
votes
4 answers

Start process with low priority Popen

I am looking for a way to start multiple process efficiently with low priority in Windows. I tried : def run(command): # command['Program.exe args1 args2','output_file'] try : p = subprocess.Popen(command[0] , stdout = command[1]) …
Coolpix
  • 503
  • 1
  • 6
  • 20
9
votes
2 answers

Why doesn't tkinter release memory when an instance is destroyed?

I wanted a quick and dirty way to get some file names without typing in my shell, so I have this following piece of code: from tkinter.filedialog import askopenfile file = askopenfile() Now this all works fine, but it does create a superfluous…
r.ook
  • 13,466
  • 2
  • 22
  • 39
9
votes
2 answers

Apache Airflow ImportError: cannot import name '_psutil_linux'

I am installing apache airflow as per the installation steps provided at https://airflow.apache.org/start.html#quick-start First Step - export AIRFLOW_HOME=~/airflow (No error) Second Step - pip install apache-airflow (No error) Third Step -…
kavi pandya
  • 161
  • 3
  • 5
9
votes
2 answers

psutil in Apache Spark

I'm using PySpark 1.5.2. I got UserWarning Please install psutil to have better support with spilling after I issue the command .collect() Why is this warning showed? How can I install psutil?
wannik
  • 12,212
  • 11
  • 46
  • 58
8
votes
2 answers

Can't Install psutil

Can someone help me understand why I can't install psutil? I'm on MacOS. I'm a noob so bear with me, but any help would be appreciated. Could it be something to do with the default Python install vs v3 that I installed? I'm new to command line so…
KWKDev
  • 81
  • 1
  • 1
  • 2
8
votes
1 answer

Why does reading a whole file take up more RAM than its size on DISK?

Caveat This is NOT a duplicate of this. I'm not interested in finding out my memory consumption or the matter, as I'm already doing that below. The question is WHY the memory consumption is like this. Also, even if I did need a way to profile my…
Marius Mucenicu
  • 1,685
  • 2
  • 16
  • 25
8
votes
0 answers

Using psutil to find all foreground apps

When I enter Task Manager I can see two sections. Apps(3) and Background processes(94). What I'm trying to do is get only those 3 that are not in the background. My code: for proc in psutil.process_iter(): print(proc.name()) But this gives me…
pantank14
  • 175
  • 1
  • 10
1
2 3
32 33