Closed akhan3 closed 3 years ago
This bug probably belongs to the upstream project https://github.com/giampaolo/psutil. Thoughts?
Hey, thanks for the detailed report.
Could you please check what psutil.cpu_freq()
returns when run it without s-tui in a vm.
Running something like this:
python3 -c "import psutil; print(psutil.cpu_freq())"
On a physical Ubuntu 20.04 system,
$ python3 -c "import psutil; print(psutil.cpu_freq())"
scpufreq(current=2369.3248750000002, min=800.0, max=4000.0)
Thanks. What does it return on the VM you are trying to run s-tui on?
aamir@ip-172-31-34-48:~$ sudo apt install -y python3-psutil
aamir@ip-172-31-34-48:~$ python3 -c "import psutil; print(psutil.cpu_freq())"
None
Thanks, that should be an easy fix. Can you please check if it works on branch fix_unsaved_summaries
Same error.
aamir@ip-172-31-34-48 (fix_unsaved_summaries) ~/work/s-tui/build/lib$ python3 -m s_tui.s_tui
WARNING:root:Failed to find or create scripts directory, proceeding without scripting support
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/aamir/work/s-tui/build/lib/s_tui/s_tui.py", line 947, in <module>
main()
File "/home/aamir/work/s-tui/build/lib/s_tui/s_tui.py", line 901, in main
graph_controller = GraphController(args)
File "/home/aamir/work/s-tui/build/lib/s_tui/s_tui.py", line 713, in __init__
possible_sources = self._load_config(args.t_thresh)
File "/home/aamir/work/s-tui/build/lib/s_tui/s_tui.py", line 646, in _load_config
FreqSource(),
File "/home/aamir/work/s-tui/build/lib/s_tui/sources/freq_source.py", line 50, in __init__
self.top_freq = psutil.cpu_freq().max
AttributeError: 'NoneType' object has no attribute 'max'
Thanks. Just to make sure, what is last commit you are working with?
Also, what vm manager are you using and what os are you running in the vm?
I am working with commit 7260a6e621e199e0bb3e9562de7289f94e824c5f
.
I am using Ubuntu 20.04 on an AWS EC2 virtual machine.
$ lscpu | grep -i hypervisor
Hypervisor vendor: Xen
Following is the build log.
aamir@ip-172-31-34-48 (fix_unsaved_summaries) ~/work/s-tui$ git show -s
commit 7260a6e621e199e0bb3e9562de7289f94e824c5f (HEAD -> fix_unsaved_summaries, origin/fix_unsaved_summaries)
Author: Alex Manuskin <amanusk@tuta.io>
Date: Fri Jul 3 18:46:51 2020 +0300
Only check not none if attr exists
aamir@ip-172-31-34-48 (fix_unsaved_summaries) ~/work/s-tui$ git status
On branch fix_unsaved_summaries
Your branch is up to date with 'origin/fix_unsaved_summaries'.
nothing to commit, working tree clean
aamir@ip-172-31-34-48 (fix_unsaved_summaries) ~/work/s-tui$ python3 setup.py build
running build
running build_py
creating build
creating build/lib
creating build/lib/s_tui
copying s_tui/help_menu.py -> build/lib/s_tui
copying s_tui/stress_menu.py -> build/lib/s_tui
copying s_tui/__init__.py -> build/lib/s_tui
copying s_tui/about_menu.py -> build/lib/s_tui
copying s_tui/s_tui.py -> build/lib/s_tui
copying s_tui/helper_functions.py -> build/lib/s_tui
copying s_tui/sensors_menu.py -> build/lib/s_tui
creating build/lib/s_tui/sources
copying s_tui/sources/temp_source.py -> build/lib/s_tui/sources
copying s_tui/sources/source.py -> build/lib/s_tui/sources
copying s_tui/sources/rapl_power_source.py -> build/lib/s_tui/sources
copying s_tui/sources/util_source.py -> build/lib/s_tui/sources
copying s_tui/sources/rapl_read.py -> build/lib/s_tui/sources
copying s_tui/sources/fan_source.py -> build/lib/s_tui/sources
copying s_tui/sources/__init__.py -> build/lib/s_tui/sources
copying s_tui/sources/hook.py -> build/lib/s_tui/sources
copying s_tui/sources/hook_script.py -> build/lib/s_tui/sources
copying s_tui/sources/script_hook_loader.py -> build/lib/s_tui/sources
copying s_tui/sources/freq_source.py -> build/lib/s_tui/sources
creating build/lib/s_tui/sturwid
copying s_tui/sturwid/complex_bar_graph.py -> build/lib/s_tui/sturwid
copying s_tui/sturwid/ui_elements.py -> build/lib/s_tui/sturwid
copying s_tui/sturwid/__init__.py -> build/lib/s_tui/sturwid
copying s_tui/sturwid/summary_text_list.py -> build/lib/s_tui/sturwid
copying s_tui/sturwid/bar_graph_vector.py -> build/lib/s_tui/sturwid
aamir@ip-172-31-34-48 (fix_unsaved_summaries) ~/work/s-tui$ cd ~/work/s-tui/build/lib/
aamir@ip-172-31-34-48 (fix_unsaved_summaries) ~/work/s-tui/build/lib$ python3 -m s_tui.s_tui
WARNING:root:Failed to find or create scripts directory, proceeding without scripting support
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/aamir/work/s-tui/build/lib/s_tui/s_tui.py", line 947, in <module>
main()
File "/home/aamir/work/s-tui/build/lib/s_tui/s_tui.py", line 901, in main
graph_controller = GraphController(args)
File "/home/aamir/work/s-tui/build/lib/s_tui/s_tui.py", line 713, in __init__
possible_sources = self._load_config(args.t_thresh)
File "/home/aamir/work/s-tui/build/lib/s_tui/s_tui.py", line 646, in _load_config
FreqSource(),
File "/home/aamir/work/s-tui/build/lib/s_tui/sources/freq_source.py", line 50, in __init__
self.top_freq = psutil.cpu_freq().max
AttributeError: 'NoneType' object has no attribute 'max'
Thanks, I am not able to reproduce on a VM with 18.04. I'll try to see if I can reproduce on 20.04 when I get a chance.
If you find a fix, feel free to open a PR
I tried commit 11cf46098bd1c263b3b27d52d876069e5e0bfeec on 18.04 VM and experience the same error.
$ python3 -m s_tui.s_tui
WARNING:root:Failed to find or create scripts directory, proceeding without scripting support
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/aamir/work/s-tui/build/lib/s_tui/s_tui.py", line 947, in <module>
main()
File "/home/aamir/work/s-tui/build/lib/s_tui/s_tui.py", line 901, in main
graph_controller = GraphController(args)
File "/home/aamir/work/s-tui/build/lib/s_tui/s_tui.py", line 713, in __init__
possible_sources = self._load_config(args.t_thresh)
File "/home/aamir/work/s-tui/build/lib/s_tui/s_tui.py", line 646, in _load_config
FreqSource(),
File "/home/aamir/work/s-tui/build/lib/s_tui/sources/freq_source.py", line 50, in __init__
self.top_freq = psutil.cpu_freq().max
AttributeError: 'NoneType' object has no attribute 'max'
Can you please elaborate the step you made to get this
I have just started a new 18.04 vm, and did the following steps:
sudo apt install python3-pip
pip install psutil
pip install urwid
Clone s-tui, run with python3 -m s_tui.s_tui
s-tui starts and works.
I have this problem on 20.04 bare-metal. No idea how to proceed. What can I do to debug?
@nickdnk can you share more details, s-tui version, hardware etc?
Yes. This is on an Intel 9600K with an MSI motherboard. I run the Liquorix kernel (https://liquorix.net/) version 5.8. The s-tui version is just the latest available from the ubuntu repos using apt install s-tui
.
Please try to run the latest version available with pip. (pip install s-tui --user
)
If this does not work, please paste the error message here
That worked (using pip3 though). But it's very, very slow. Is that normal? Navigating the app is almost impossible due to latency.
No, this is unusual. If you don't mind please share a screen record. Also, maybe try another terminal. I haven't encountered that before. Consider opening a separate issue.
On my physical Ubuntu 20.04 machine python3 -c "import psutil; print(psutil.cpu_freq())"
returns None
also.
I had a similar issue on Ubuntu 20.04 and s-tui 1.0.0-beta3 running on a barebone machine, and it turned out that the error was caused by disabling AMD Cool'n'Quiet
in the bios. Rayzen 2700x on ax370 motherboard.
The 1.0.0-beta3
version that comes bundled with ubuntu 20.04 had some bugs. Some of them were solved in later versions.
Can you please try running 1.0.2 from source and report if you have similar issues?
I tried s-tui 1.1.0
and it works fine. Thank you.
s-tui -v
s-tui 1.1.0 - (C) 2017-2020 Alex Manuskin, Gil Tsuker
Released under GNU GPLv2
That's great. Thanks. Closing for now
I got the same error.
$ cat /etc/issue
Debian GNU/Linux bookworm/sid \n \l
$ uname -a
Linux Debian-StarFive 5.17.0-rc4-starfive-rc4 #1 SMP PREEMPT Wed Feb 16 00:47:02 CST 2022 riscv64 GNU/Linux
$ sudo apt install s-tui stress
$ s-tui
Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/usr/lib/python3/dist-packages/s_tui/s_tui.py", line 958, in
main() File "/usr/lib/python3/dist-packages/s_tui/s_tui.py", line 912, in main graph_controller = GraphController(args) File "/usr/lib/python3/dist-packages/s_tui/s_tui.py", line 716, in init possible_sources = self._load_config(args.t_thresh) File "/usr/lib/python3/dist-packages/s_tui/s_tui.py", line 649, in _load_config FreqSource(), File "/usr/lib/python3/dist-packages/s_tui/sources/freq_source.py", line 50, in init self.top_freq = psutil.cpu_freq().max AttributeError: 'NoneType' object has no attribute 'max'
$ sudo pip install psutil
$ sudo pip install urwid
$ s-tui
Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/usr/lib/python3/dist-packages/s_tui/s_tui.py", line 958, in
main() File "/usr/lib/python3/dist-packages/s_tui/s_tui.py", line 912, in main graph_controller = GraphController(args) File "/usr/lib/python3/dist-packages/s_tui/s_tui.py", line 716, in init possible_sources = self._load_config(args.t_thresh) File "/usr/lib/python3/dist-packages/s_tui/s_tui.py", line 649, in _load_config FreqSource(), File "/usr/lib/python3/dist-packages/s_tui/sources/freq_source.py", line 50, in init self.top_freq = psutil.cpu_freq().max AttributeError: 'NoneType' object has no attribute 'max'
Got the same error, but after updating psutil
and urwid
packages, everything worked as expected:
Before:
~# python3 -c "import psutil; print(psutil.cpu_freq())"
None
pip install -U urwid
pip install -U psutil
:~# python3 -c "import psutil; print(psutil.cpu_freq())"
scpufreq(current=2445.358, min=0.0, max=0.0)
then s-tui worked as expected.
Step 1: Describe your environment
apt install s-tui
from Ubuntu 20.04 repoStep 2: Describe the problem:
The program crashes upon launch.
Observed Results:
The problem seems to be that
psutil.cpu_freq()
returnsNone
on a VM.Debug Results, output of
s-tui -d
created in a file_s-tui.log
:Step 3: Reproduce the problem: