Closed aprosvetova closed 3 years ago
I'm still seeing this issue on v0.2.2
~ ❯ tiptop --version base
tiptop 0.2.2 [Python 3.9.5]
Copyright (c) 2021-2022 Nico Schlömer
full traceback:
~ ❯ tiptop ✘ INT base
╭───────────────────────────── Traceback (most recent call last) ──────────────────────────────╮
│ │
│ /Users/jhamman/mambaforge/lib/python3.9/site-packages/tiptop/_cpu.py:207 in on_mount │
│ │
│ 204 │ │ ) │
│ 205 │ │ │
│ 206 │ │ # immediately collect data to refresh info_box_width │
│ ❱ 207 │ │ self.collect_data() │
│ 208 │ │ self.set_interval(2.0, self.collect_data) │
│ 209 │ │
│ 210 │ def collect_data(self): │
│ │
│ ╭────────────── locals ──────────────╮ │
│ │ box_title = '8 cores, 8 threads' │ │
│ │ num_threads = 8 │ │
│ │ self = CPU(name='CPU#1') │ │
│ │ temps = None │ │
│ ╰────────────────────────────────────╯ │
│ /Users/jhamman/mambaforge/lib/python3.9/site-packages/tiptop/_cpu.py:246 in collect_data │
│ │
│ 243 │ │ │ cpu_total_graph += "[magenta]" + "\n".join(lines_temp) + "[/]" │
│ 244 │ │ │
│ 245 │ │ # construct right info box │
│ ❱ 246 │ │ self._refresh_info_box(load_per_thread) │
│ 247 │ │ │
│ 248 │ │ t = Table(expand=True, show_header=False, padding=0, box=None) │
│ 249 │ │ # Add ratio 1 to expand that column as much as possible │
│ │
│ ╭───────────────────────────────────────── locals ─────────────────────────────────────────╮ │
│ │ cpu_total_graph = '[blue] 18.5%\n │ │
│ │ '+286 │ │
│ │ current_val_string = ' 18.5%' │ │
│ │ lines0 = ' 18.5%' │ │
│ │ lines_cpu = [ │ │
│ │ │ ' 18.5%', │ │
│ │ │ ' ', │ │
│ │ │ ' ', │ │
│ │ │ ' ', │ │
│ │ │ ' ', │ │
│ │ │ ' ⢠', │ │
│ │ │ ' ⢸' │ │
│ │ ] │ │
│ │ load = 0.0 │ │
│ │ load_per_thread = [25.0, 12.5, 6.7, 18.8, 25.0, 60.0, 0.0, 0.0] │ │
│ │ self = CPU(name='CPU#1') │ │
│ │ stream = <tiptop.braille_stream.BrailleStream object at 0x106dadee0> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /Users/jhamman/mambaforge/lib/python3.9/site-packages/tiptop/_cpu.py:302 in │
│ _refresh_info_box │
│ │
│ 299 │ │ │
│ 300 │ │ self.info_box.renderable = "\n".join(lines) │
│ 301 │ │ │
│ ❱ 302 │ │ cpu_freq = get_current_freq() │
│ 303 │ │ │
│ 304 │ │ if cpu_freq is None: │
│ 305 │ │ │ # https://github.com/nschloe/tiptop/issues/25 │
│ │
│ ╭──────────────────────────── locals ─────────────────────────────╮ │
│ │ color = 'blue' │ │
│ │ core_id = 7 │ │
│ │ i = 7 │ │
│ │ line = ['[blue] 0%[/]'] │ │
│ │ lines = [ │ │
│ │ │ '[cyan] ⢀ 25%[/]', │ │
│ │ │ '[blue] ⢀ 12%[/]', │ │
│ │ │ '[blue] ⢀ 7%[/]', │ │
│ │ │ '[cyan] ⢀ 19%[/]', │ │
│ │ │ '[cyan] ⢀ 25%[/]', │ │
│ │ │ '[cyan] ⢰ 60%[/]', │ │
│ │ │ '[blue] 0%[/]', │ │
│ │ │ '[blue] 0%[/]' │ │
│ │ ] │ │
│ │ load_per_thread = [25.0, 12.5, 6.7, 18.8, 25.0, 60.0, 0.0, 0.0] │ │
│ │ self = CPU(name='CPU#1') │ │
│ │ thread_ids = [7] │ │
│ ╰─────────────────────────────────────────────────────────────────╯ │
│ │
│ /Users/jhamman/mambaforge/lib/python3.9/site-packages/tiptop/_cpu.py:107 in get_current_freq │
│ │
│ 104 │ │ │ │ content = f.read() │
│ 105 │ │ │ return int(content) / 1000 │
│ 106 │ │
│ ❱ 107 │ c = psutil.cpu_freq() │
│ 108 │ if hasattr(c, "current"): │
│ 109 │ │ cpu_freq = c.current │
│ 110 │ │ if psutil.__version__ == "5.9.0" and cpu_freq < 10: │
│ │
│ ╭──────────────────────────────────── locals ─────────────────────────────────────╮ │
│ │ candidate = '/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq' │ │
│ │ candidates = [ │ │
│ │ │ '/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq', │ │
│ │ │ '/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq' │ │
│ │ ] │ │
│ │ file = PosixPath('/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq') │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /Users/jhamman/mambaforge/lib/python3.9/site-packages/psutil/__init__.py:1859 in cpu_freq │
│ │
│ 1856 │ │ retrieval (Linux only) a list of frequencies is returned for │
│ 1857 │ │ each CPU. If not a list with one element is returned. │
│ 1858 │ │ """ │
│ ❱ 1859 │ │ ret = _psplatform.cpu_freq() │
│ 1860 │ │ if percpu: │
│ 1861 │ │ │ return ret │
│ 1862 │ │ else: │
│ │
│ ╭──── locals ────╮ │
│ │ percpu = False │ │
│ ╰────────────────╯ │
│ │
│ /Users/jhamman/mambaforge/lib/python3.9/site-packages/psutil/_psosx.py:180 in cpu_freq │
│ │
│ 177 │ Also, the returned frequency never changes, see: │
│ 178 │ https://arstechnica.com/civis/viewtopic.php?f=19&t=465002 │
│ 179 │ """ │
│ ❱ 180 │ curr, min_, max_ = cext.cpu_freq() │
│ 181 │ return [_common.scpufreq(curr, min_, max_)] │
│ 182 │
│ 183 │
╰──────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory (originated from
sysctlbyname('hw.cpufrequency'))
@jhamman Fixed in #76 (v0.2.3).
psutil
tries accessinghw.cpufrequency
which is not present on M1-equipped computers, sotiptop
crashes.Active issue: https://github.com/giampaolo/psutil/issues/1892