Psutil: 'psutil' has no attribute 'sensors_temperatures'

Created on 25 Apr 2018  ·  18Comments  ·  Source: giampaolo/psutil

I just tried to use psutil, but psutil.sensors_temperatures() currently returns an error
Traceback (most recent call last): File "C:/Users/Owner/Desktop/test.py", line 2, in <module> print(psutil.sensors_temperatures()) AttributeError: module 'psutil' has no attribute 'sensors_temperatures'
Using Windows 10

Most helpful comment

If you read the doc you'll notice how that is Linux only for now. =)

All 18 comments

Me too!!! Have you solved the problem? windows7 64bit python=3.5.4 64bit

no

If you read the doc you'll notice how that is Linux only for now. =)

I have the same story! Python 3.7

i have same issue at Ubuntu

>>> psutil.sensors_temperatures()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'psutil' has no attribute 'sensors_temperatures'

@alex37529, what version of pstutil do you have?
I believe it was added in 5.1.0
You can check with python -c "import psutil; print(psutil.__version__)"

I have version 5.5.0 and it is not working for me with Python 2.7.15 under Windows 7.
The psutil documentation says:

Availability: Linux, FreeBSD
New in version 5.1.0.
Changed in version 5.5.0: added FreeBSD support

sensors_temperatures() is currently not implemented on windows

i'm on mac and have version 5.6.3 and have the same problem

@lamoboos223, as per documentation, temperatures sensors are currently only available on Linux and FreeBSD platforms.

psutil only has sensors_battery attribute but it's not contains sensors_temperatures() and sensors_fans() two cool features. I really need those two modules into my project.

@Pushpajit, more details are needed. What operating system and what version of psutil are you using.

psutil.sensors_temperatures(fahrenheit=False) is currently available only for :: Linux, FreeBSD

Also psutil.sensors_fans() is available only for Linux, macOS.

the only thing u can do is put them in try catch so that you can continue further without termination of execution of code.

# Getting Temp info
try:
    GenLogs("Hardware Temperatur :",psutil.sensors_temperatures(fahrenheit=False))

except Exception as e:
    GenLogs("Exeption has occured :",str(e))

# Getting fan speed
try:
    GenLogs("Fan Speed :",psutil.sensors_fans())
except Exception as e:
    GenLogs("Exeption has occured :",str(e))

how is it possible to update the version of psutil on linux?

how is it possible to update the version of psutil on linux?

in a terminal you can hit: "python3 -m pip install --upgrade psutil"

I'm not sure if anyone's still following this issue.. but, is there any plans to gain temperature information for Windows in psutil?

I can't do it because I have a virtualized Windows box (would need a real one). Last time I checked it seems this can be done via the WMI interface. So basically whoever wants to give it a try just make a PR for it.

Thanks for the respons of @giampaolo. In my case, I was trying to expose this information ultimately in the Glances API; which depends on Psutil.

Was this page helpful?
0 / 5 - 0 ratings