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
3
votes
1 answer

How do I resolve #error: architecture not supported during pip install psutil?

I've run into some problems while trying to download packages with pip. Namely, when I run pip install "dask[complete]" on MacOS Catalina 10.15.7. Specifically, the package that throws this error is psutil. I run into an #error: architecture not…
jthree8
  • 81
  • 8
3
votes
1 answer

Locust installation: psutil compilation failed with exit status 1 Python.h: No such file or directory

I am installing locust using command pip3 install locust. I am faced with a series of errors which I am unable to understand and debug, kindly help me with what went wrong. Any help is appreciated.I have python 3.8 and python 2.7 both installed on…
Saranya Gupta
  • 1,945
  • 2
  • 10
  • 14
3
votes
1 answer

psutil.AccessDenied: psutil.AccessDenied (pid=7868)

I'm trying to kill a process (zoom.exe) with psutil. However, I'm getting an error psutil.AccessDenied. I have all the permissions to do it, and was already tested on another pc. Code def kill_process(PROCNAME): for proc in psutil.process_iter(): …
Y4RD13
  • 937
  • 1
  • 16
  • 42
3
votes
2 answers

How to use psutil module on windows?

I am trying to get cpu temperature using psutil module. I installed it using pip install psutil It installed perfectly fine. However, when I try to import it I get the following error. Traceback (most recent call last): File "", line 1,…
3
votes
1 answer

How can i kill background python processes?

I want the python syntax that will give me the list of background processes running through python itself, and kill all those processes at a time. what modification should I do in my following code? I have written this code to get all the running…
3
votes
0 answers

Does the Windows Subsystem for Linux (WSL) support cpufreq as used by Python psutil?

I am using the WSL (Ubuntu 18.04.2 LTS) for machine learning projects. So I installed autokeras 1.0 on Python 3.6 which is based on the new tensorflow 2.0. However, all autokeras examples break with the psutil error message "NotImplementedError:…
3
votes
4 answers

How to monitor usage of CPU when function is called in Python psutil?

Hey I'm learning psutil package and I want to know how to display current CPU usage when function is in progress? I suppose I need some threading or something like this, but how to do it? Thank u for any answers. import psutil import random def…
ajirebardyn
  • 43
  • 1
  • 6
3
votes
1 answer

Getting total memory and cpu usage for one python instance

I'm using keras to make and test different types of Neural Nets and need data to compare them. I need data on the cpu and memory used during the training and testing. This is in python and as I looked around I found lot of suggestions for psutil.…
Rex Pan
  • 63
  • 5
3
votes
1 answer

pip: uninstalling a disutils installed package

I am trying to install psutil with the command pip install -U psutil and that gives me the error: Cannot uninstall 'psutil'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to…
QPTR
  • 1,620
  • 7
  • 26
  • 47
3
votes
1 answer

Monitoring subprocess resources over time in python

I'm currently trying to monitor over time the memory usage of my subprocess to generate a plot. This chunk of code seems to do the trick but I REALLY don't like the "over time" loop I made, as you can see this is a basic while true loop. from…
Plopp
  • 947
  • 8
  • 16
3
votes
1 answer

How to get current CPU, GPU and RAM usage of a particular program in Python?

I have written a python program to detect faces of a video input (webcam) using Haar Cascade. I would like to know how much CPU, GPU and RAM are being utilized by this specific program and not the overall CPU, GPU, RAM usage. I came across psutil…
TheCoder
  • 87
  • 2
  • 11
3
votes
0 answers

pip3 psutil cannot install newer version

I am trying to install odoo 11.0 but when installing requirements it shows me this: Cannot uninstall 'psutil'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial…
3
votes
3 answers

psutil.AccessDenied Error while trying to load StanfordCoreNLP

I'm trying to load the package StanfordCoreNLP to get the correct parsing for the movie reviews presented in their page (https://nlp.stanford.edu/sentiment/treebank.html): (I'm using MAC) nlp =…
Cranjis
  • 1,590
  • 8
  • 31
  • 64
3
votes
3 answers

Find processes by command in python

In my Python script, i want to check if otherscript.py is currently being run on the (Linux) system. The psutil library looked like a good solution: import psutil proc_iter = psutil.process_iter(attrs=["name"]) other_script_running =…
Brett38
  • 55
  • 1
  • 5
3
votes
2 answers

psutil.test() returns None. How to write its output to a file?

I'm trying to write the psutil.test() result to a file but instead it prints out the text that I want in the file and writes "None" to the test.txt. import psutil from time import sleep while True: proccesses = psutil.test() file =…
Lojas
  • 195
  • 3
  • 13