My Python 3 script uses psutil
v5.6.2 to extract various information about the current system (Ubuntu 18.04, AMD Ryzen 2700X) such as the CPU core temperatures.
Problem: However running the following code to obtain the core temperatures
import psutil
psutil.sensors_temperatures()
returns an empty dict
{}
even though running lmsensors
(sensors version 3.4.0 with libsensors version 3.4.0, Ubuntu 18.04) does return the temperatures
$ sensors
nouveau-pci-1f00
Adapter: PCI adapter
GPU core: +0.91 V (min = +0.80 V, max = +1.19 V)
temp1: +36.0°C (high = +95.0°C, hyst = +3.0°C)
(crit = +105.0°C, hyst = +5.0°C)
(emerg = +135.0°C, hyst = +5.0°C)
k10temp-pci-00c3
Adapter: PCI adapter
Tdie: +79.4°C (high = +70.0°C)
Tctl: +89.4°C
Why is psutil
not giving us the temperatures we need, and how can we solve this problem?
PS: Also looked into Pysensors
but it does not support Python 3. Any suggestions on a Python 3 alternative?
psutil
, it gives memodule 'psutil' has no attribute 'sensors_temperatures'
forv5.6.3
- Devesh Kumar Singhpsutil
in Linux (Ubuntu 18.04) - Nyxynyxv5.6.2
. This function can be found in the docs psutil.readthedocs.io/en/latest/#psutil.sensors_temperatures - Nyxynyxsensors_temperatures
function in the docs specifically stated Availability: Linux, FreeBSD - Nyxynyxpsutil
reads temperatures from/sys/class/hwmon/hwmon...
whilelm sensors
reads directly from chips. - VPfB