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

AttributeError: module 'psutil' has no attribute 'sensors_temperatures' #10

Closed
fryfrog opened this issue Jul 11, 2019 · 3 comments
Closed

Comments

@fryfrog
Copy link

fryfrog commented Jul 11, 2019

This raspbian install was done following the guide at https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-fan-shim, basically just sudo ./install.sh and sudo ./examples/install-service.sh 65 5.

giampaolo/psutil#1271

Maybe an old version of python-psutil?

0 ✓ fryfrog@raspbian-armv7l ~ $ sudo /home/fryfrog/fanshim-python/examples/automatic.py --threshold 55 --hysteresis 5 --delay 2
Traceback (most recent call last):
  File "/home/fryfrog/fanshim-python/examples/automatic.py", line 70, in <module>
    t = get_cpu_temp()
  File "/home/fryfrog/fanshim-python/examples/automatic.py", line 38, in get_cpu_temp
    return psutil.sensors_temperatures()['cpu-thermal'][0].current
AttributeError: module 'psutil' has no attribute 'sensors_temperatures'
@fryfrog
Copy link
Author

fryfrog commented Jul 11, 2019

I used pip and pip3 to install the latest version, but the error persists.

0 ✓ fryfrog@raspbian-armv7l ~ $ python3 -c "import psutil; print(psutil.__version__)"
5.6.3
0 ✓ fryfrog@raspbian-armv7l ~ $ python -c "import psutil; print(psutil.__version__)"
5.6.3

@fryfrog
Copy link
Author

fryfrog commented Jul 11, 2019

And after removing the apt versions of psutil and rpi.gpio, it doesn't even see they're there, even though the above test works fine. I don't know enough debian python yet to understand why. :/

0 ✓ fryfrog@raspbian-armv7l ~ $ sudo ./automatic.py
Traceback (most recent call last):
  File "./automatic.py", line 3, in <module>
    import psutil
ImportError: No module named 'psutil'

@fryfrog
Copy link
Author

fryfrog commented Jul 11, 2019

Ugh, this was so easy... running pip as yourself installs it for yourself, the script runs as root so needs to be installed by root.

@fryfrog fryfrog closed this as completed Jul 11, 2019
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

1 participant