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

KeyError: 'combined_power' on MacOS 12.4/12.6.3 on M1 Max #51

Open
emidln-imc opened this issue Feb 1, 2023 · 4 comments · May be fixed by #52
Open

KeyError: 'combined_power' on MacOS 12.4/12.6.3 on M1 Max #51

emidln-imc opened this issue Feb 1, 2023 · 4 comments · May be fixed by #52

Comments

@emidln-imc
Copy link

Hardware Overview

  Model Name:	MacBook Pro
  Model Identifier:	MacBookPro18,2
  Chip:	Apple M1 Max
  Total Number of Cores:	10 (8 performance and 2 efficiency)
  Memory:	64 GB
  System Firmware Version:	7459.121.3
  OS Loader Version:	7459.121.3

Exception

$ sudo asitop 

ASITOP - Performance monitoring CLI tool for Apple Silicon
You can update ASITOP by running `pip install asitop --upgrade`
Get help at `https://github.com/tlkh/asitop`
P.S. You are recommended to run ASITOP with `sudo asitop`


[1/3] Loading ASITOP



[2/3] Starting powermetrics process


[3/3] Waiting for first reading...

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/asitop/utils.py", line 18, in parse_powermetrics
    cpu_metrics_dict = parse_cpu_metrics(powermetrics_parse)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/asitop/parsers.py", line 133, in parse_cpu_metrics
    cpu_metric_dict["package_W"] = cpu_metrics["combined_power"]/1000
                                   ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'combined_power'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/bin/asitop", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/asitop/asitop.py", line 159, in main
    ready = get_reading()
            ^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/asitop/asitop.py", line 156, in get_reading
    ready = parse_powermetrics(timecode=timecode)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/asitop/utils.py", line 29, in parse_powermetrics
    cpu_metrics_dict = parse_cpu_metrics(powermetrics_parse)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/asitop/parsers.py", line 133, in parse_cpu_metrics
    cpu_metric_dict["package_W"] = cpu_metrics["combined_power"]/1000
                                   ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'combined_power'

Python version (built by brew install python@3.11)

python3.11 --version
Python 3.11.1

asitop version 0.0.23

pip3.11 freeze  | grep asitop
asitop==0.0.23
@emidln-imc
Copy link
Author

I updated to the latest MacOs 12.x patch release I have access to, 12.6.3, and I still see the same issue.

@emidln-imc emidln-imc changed the title KeyError: 'combined_power' on MacOS 12.4 on M1 Max KeyError: 'combined_power' on MacOS 12.4/12.6.3 on M1 Max Feb 1, 2023
@emidln-imc emidln-imc linked a pull request Feb 1, 2023 that will close this issue
@zenyr
Copy link

zenyr commented Feb 2, 2023

(For someone googled this issue) If you're in a hurry as an end-user you can install 0.0.21 that does not have this code:

pip install asitop==0.0.21

@mikez226
Copy link

I also meet this problem on 12.6.3, is there anyone fix it?

@dehydratedpotato
Copy link

The key was recently changed to combined_power for compatibility with Ventura, but this broke compatibility with Monterey, where the key was originally package_energy...

There is a PR for fixing this at #52, hopefully it gets merged soon?

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

Successfully merging a pull request may close this issue.

4 participants