Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'psutil' has no attribute 'sensors_temperatures' #1271

Closed
App24 opened this issue Apr 25, 2018 · 31 comments
Closed

'psutil' has no attribute 'sensors_temperatures' #1271

App24 opened this issue Apr 25, 2018 · 31 comments

Comments

@App24
Copy link

App24 commented Apr 25, 2018

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

@ZORfree
Copy link

ZORfree commented May 8, 2018

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

@App24
Copy link
Author

App24 commented May 8, 2018

no

@giampaolo
Copy link
Owner

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

@Changlei123
Copy link

I have the same story! Python 3.7

@alex37529
Copy link

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'

@amanusk
Copy link
Collaborator

amanusk commented Dec 25, 2018

@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__)"

@KarinWillers
Copy link

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

@giampaolo
Copy link
Owner

sensors_temperatures() is currently not implemented on windows

@lamoboos223
Copy link

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

@amanusk
Copy link
Collaborator

amanusk commented Aug 15, 2019

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

@Pushpajit
Copy link

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.

@amanusk
Copy link
Collaborator

amanusk commented Sep 13, 2019

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

@NarayanLalMenariya
Copy link

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))

@matteos1
Copy link

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

@robinechuca
Copy link

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

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

@mkanet
Copy link

mkanet commented Jun 17, 2020

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

@giampaolo
Copy link
Owner

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.

@mkanet
Copy link

mkanet commented Jun 17, 2020

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.

@alvinbengeorge
Copy link

@giampaolo, I think I have a solution to this, you can use WMI for this right? If we can use that, we might get the temperature in Windows 10. I checked the internet, and I found out that we need a dll file from an application called OpenHardwareMonitor
Thank You

@giampaolo
Copy link
Owner

giampaolo commented Apr 2, 2021

We can't use external DLLs. My comment about WMI meant that the implementation should (probably) be done by using WMI interface in C.

@alvinbengeorge
Copy link

alvinbengeorge commented Apr 2, 2021 via email

@giampaolo
Copy link
Owner

Thank you, I appreciate it.

@mkanet
Copy link

mkanet commented Apr 2, 2021

Is there a way to have a multi-platform solution for temperatures? Even if there's a solution for Windows, it still wouldn't work for Mac users.

@MD-khan
Copy link

MD-khan commented Apr 4, 2022

Same story here

@hulitolku
Copy link

When fix this trouble?

@mkanet
Copy link

mkanet commented Apr 19, 2022

I would be very happy with a solution for Windows.

@mortee
Copy link

mortee commented Jun 1, 2022

+1 here

@mortee
Copy link

mortee commented Jun 1, 2022

How is this issue even closed as "completed"? It's still outstanding, as temp sensors are still only available on Linux and FreeBSD. At least a "won't fix" would give a proper indication on intentions.

@jjziets
Copy link

jjziets commented Jun 14, 2022

im not getting psutil.sensors_temperatures(fahrenheit=False) to work on lunix ubunut 20.04

import psutil
psutil.sensors_temperatures(fahrenheit=False)
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'sensors_temperatures'

@tiagorangel2011
Copy link

I'll also having this problem. The PyPI page (https://pypi.org/project/psutil/#sensors) says it supports Windows, but I am getting the error.

@jasmeralia
Copy link

This should be reopened as a feature request, not closed as completed; that's very misleading. Even if you aren't going to be the one to implement it, someone else who does should still be associating it with an open issue, and having an open feature request will make it easier for people to understand why it's not working. Also, the PyPi page should be updated to indicate that the sensor functions are only supported on Linux and FreeBSD. There's no mention there of this limitation, while it does say that Windows is a supported platform, which again is misleading.

I'm not super familiar with WMI, but I'll do some digging and see if I can come up with something for the Windows side.

I do have a MacBook as well, and I'd previously done some stuff with temperatures in htop-osx. I'll see if I can dig that out and see if it provides any guidance. That was C rather than Python, but I know there are ways to leverage C code in Python if necessary. That said, I have an older Intel-based MacBook (which they don't make anymore), so I can't really speak to Apple Silicon.

It's possible I could get it to work on a mac2.metal EC2 instance, since those are actually Apple Silicon Mac Minis run in AWS, but there's a minimum 24h billing charge for those, and I'm not entirely sure if there's a virtualization layer on top of the hardware... I know it's a 1:1 allocation between the EC2 instance ahd the Mac Mini dedicated host, so I suspect it's probably just some provisioning tweaks over the bare metal, but I'm not 100% confident of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests