permon icon indicating copy to clipboard operation
permon copied to clipboard

Test permon on MacOS

Open bminixhofer opened this issue 5 years ago • 6 comments

Permon already works well on Linux, so I do not expect many issues on MacOS. I would greatly appreciate if someone else could test it because I do not currently have access to a mac. The test procedure on MacOS would be:

  1. Install permon: pip install git+https://github.com/bminixhofer/permon 1.1 Try permon terminal, permon browser and permon native and manually ensure adding / removing stats works and all stats are properly displayed. 1.2 Try adding a simple custom stat as described in the user doc.
  2. Clone permon and set it up for development as described in the contributor guide. 2.1 Run the tests and see if all of them pass: pytest tests/. 2.2 Build the docs (./bin/build-docs.sh) and the browser frontend (./bin/build-browser.sh) and see if these work without errors.

Make sure to do all of this in a virtual environment so that dependencies are not already installed.

bminixhofer avatar Dec 05 '18 07:12 bminixhofer

Hey! I've been browsing GitHub help wanted and found this issue. If you'd like I can run your test procedure on my Mac tonight (I'm on GMT).

NickFitton avatar Dec 05 '18 08:12 NickFitton

Thanks! That would be great. I just added one more step to the procedure and fixed a link. Its good to go now.

bminixhofer avatar Dec 05 '18 12:12 bminixhofer

Apologies for the delay permon terminal worked fine after it installing blessings There were a few weird points such as the error at the bottom of the view:

    7300 ┤                                                                              │                   
CPU Usage [%]                                                                         ╭ ├                   
   400.0 ┤                                                                              │                   
   371.4 ┤                                                                              │                   
   342.9 ┤                                                                              │                   
   314.3 ┤                                                                              │                   
   285.7 ┤  ╭╮                                                                          │                   
   257.1 ┤  ││ ╭╮                                                                       │                   
   228.6 ┤  ││ ││                                                      ╭╮ ╭╮            │                   
   200.0 ┤  ││ ││                                                      │╰─╯╰╮           │                   
   171.4 ┤ ╭╯│ ││                    ╭╮  ╭╮         ╭╮               ╭─╯    │╭╮ ╭╮      │                   
   142.9 ┤ │ │ ││              ╭─────╯╰╮ ││    ╭╮  ╭╯╰─╮   ╭╮ ╭╮     │      ╰╯╰╮││      │                   
   114.3 ┤─╯ ╰╮││ ╭╮  ╭╮  ╭╮╭╮╭╯       │╭╯╰╮╭╮╭╯╰──╯   ╰───╯╰─╯╰╮  ╭─╯         ╰╯╰╮     │                   
    85.7 ┤    ││╰╮│╰─╮││╭─╯╰╯││        ││  ╰╯╰╯                 ╰──╯              ╰╮    │                   
    57.1 ┤    ╰╯ ╰╯  ╰╯╰╯    ╰╯        ╰╯                                          ╰─── ├                   
    28.6 ┤                                                                              │ other             
     0.0 ┤                                                                              │                   
RAM Usage [MB]                                                                          │                   
   17100 ┤                                                                              │                   
   15900 ┤                                                                              │                   
   14700 ┤                                                                              │                   
   13400 ┤                                                                              │                   
   12200 ┤                                                                              │                   
   11000 ┤                                                                              │                   
    9800 ┤                                                                              │                   
    8500 ┤                                                                              │                   
    7300 ┤                                                                              │                   
    6100 ┤───────────────────────────────────────────────────────────────────────────── ├                   
    4900 ┤                                                                              │                   
    3600 ┤                                                                              │                   
    2400 ┤                                                                              │ other             
    1200 ┤                                                                              │                   
       0 ┤                                                                              │                   
Disk Read Speed [MB / s]                                                                │                   
   0.033 ┤                                      ╭────────╮                              │                   
   0.030 ┤                                      │        │                              │                   
   0.028 ┤                                      │        │                              │                   
   0.026 ┤                                      │        │                              │                   
   0.023 ┤                                      │        │                              │                   
   0.021 ┤                                      │        │                              │                   
   0.019 ┤                                      │        │                              │                   
   0.016 ┤                                      │        │                              │                   
   0.014 ┤                                      │        │                              │                   
   0.012 ┤                                      │        │                              │                   
   0.009 ┤     ╭────────╮                       │        │                              │                   
   0.007 ┤     │        │                       │        │                              │                   
   0.005 ┤     │        │                       │        │                              │                   
   0.002 ┤     │        │                       │        │                              │                   
   0.000 ┤─────╯        ╰───────────────────────╯        ╰───────────────────────────── │                   
Disk Write Speed [MB / s]] Operation not permitted
   0.324 ┤     ╭────────╮                                                               │                   
   0.300 ┤     │        │                                                               │                   
   0.277 ┤     │        │                                                               │                   
   0.254 ┤     │        │                                                               │                   
   0.231 ┤     │        │                                                               │                      0.208 ┤     │        │                                                               │                   
   0.185 ┤     │        │                                                               │                   
   0.162 ┤     │        │                                                               │                   
   0.139 ┤     │        │                                                               │                   
   0.116 ┤     │        │                                                               │                      0.092 ┤     │        │                                                               │                   
   0.069 ┤     │        │                                                               │                   
   0.046 ┤     │        │                                                               │                   
   0.023 ┤     │        │             ╭────────╮                                        │                   
   0.000 ┤─────╯        ╰─────────────╯        ╰─────────────────────────────────────── │                   
    raise AccessDenied(self.pid, self._name)
psutil._exceptions.AccessDenied: psutil.AccessDenied (pid=0, name='kernel_task')

Re-running in a smaller terminal shows this error at the top of the terminal display:

Traceback (most recent call last):
CPU Usage [%]ate/tmp/permon/lib/python3.6/site-packages/psutil/_psosx.py", line 342, in wrapper

Screenshot of the terminal

Running permon browser: Prompted to install:

  • flask which was successful
  • flask-sockets which threw the following
Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/private/var/folders/vb/5z4mn7bx2nj2qnd7f90dwvz80000gp/T/pip-req-tracker-mtc54bpb/c5702e841d4232e8e1386883eba03981097635054ee0c8717fd003d5'
  • flask-login
Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/private/var/folders/vb/5z4mn7bx2nj2qnd7f90dwvz80000gp/T/pip-req-tracker-mtc54bpb/64c63d2140f428aa36a78084538e426e66b656ce29b347b4cf613ad9'

So permon browser would not run.

permon native requested to install PySide2 Upon installation threw the following in the terminal:

08-12-2018 06:47:15 pm 	 Added stat core.cpu_usage
08-12-2018 06:47:15 pm 	 Added stat core.ram_usage
08-12-2018 06:47:15 pm 	 Added stat core.read_speed
08-12-2018 06:47:15 pm 	 Added stat core.write_speed
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/private/tmp/permon/lib/python3.6/site-packages/psutil/_psosx.py", line 342, in wrapper
    return fun(self, *args, **kwargs)
  File "/private/tmp/permon/lib/python3.6/site-packages/psutil/_psosx.py", line 486, in cpu_times
    rawtuple = self._get_pidtaskinfo()
  File "/private/tmp/permon/lib/python3.6/site-packages/psutil/_common.py", line 340, in wrapper
    return fun(self)
  File "/private/tmp/permon/lib/python3.6/site-packages/psutil/_psosx.py", line 401, in _get_pidtaskinfo
    ret = cext.proc_pidtaskinfo_oneshot(self.pid)
PermissionError: [Errno 1] Operation not permitted

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/private/tmp/permon/lib/python3.6/site-packages/permon/backend/stats/core.py", line 329, in _read_processes
    'cpu': proc.cpu_percent(),
  File "/private/tmp/permon/lib/python3.6/site-packages/psutil/__init__.py", line 987, in cpu_percent
    pt2 = self._proc.cpu_times()
  File "/private/tmp/permon/lib/python3.6/site-packages/psutil/_psosx.py", line 347, in wrapper
    raise AccessDenied(self.pid, self._name)
psutil._exceptions.AccessDenied: psutil.AccessDenied (pid=0, name='kernel_task')

Trying to add CPU temperature threw:

Traceback (most recent call last):
  File "/private/tmp/permon/lib/python3.6/site-packages/permon/frontend/native/utils.py", line 90, in addStat
    stat.check_availability()
  File "/private/tmp/permon/lib/python3.6/site-packages/permon/backend/stats/core.py", line 248, in check_availability
    if 'coretemp' not in psutil.sensors_temperatures():
AttributeError: module 'psutil' has no attribute 'sensors_temperatures'
file:///private/tmp/permon/lib/python3.6/site-packages/permon/frontend/native/qml/SettingsDrawer.qml:141: Error: module 'psutil' has no attribute 'sensors_temperatures'

Trying to add vRAM usage printed in the GUI: Error: /bin/sh: nvidia-smi: command not found Removing RAM from the display caused the app to freeze. Restarting worked and the RAM was no longer visible but nothing was logged about the freeze.

Removing all graphs showed:

Ignored NaN, Inf, or -Inf value.
file:///private/tmp/permon/lib/python3.6/site-packages/permon/frontend/native/qml/StatPage.qml:220: TypeError: Cannot call method 'forEach' of undefined

Running tests on the source throws:

(permonRepo) ➜  permon git:(dev) pytest tests
============================= test session starts ==============================
platform darwin -- Python 3.6.5, pytest-3.7.4, py-1.7.0, pluggy-0.8.0
rootdir: /private/tmp/permonRepo/permon, inifile:
plugins: mock-1.10.0, cov-2.5.1
collected 0 items / 1 errors                                                   

==================================== ERRORS ====================================
____________________ ERROR collecting tests/test_permon.py _____________________
tests/test_permon.py:18: in <module>
    stat.check_availability()
permon/backend/stats/core.py:248: in check_availability
    if 'coretemp' not in psutil.sensors_temperatures():
E   AttributeError: module 'psutil' has no attribute 'sensors_temperatures'
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.64 seconds ============================

NickFitton avatar Dec 08 '18 18:12 NickFitton

If you'd like me to tweak or change anythong let me know

NickFitton avatar Dec 08 '18 18:12 NickFitton

Thanks a lot! To sum up, the issues are:

  • [x] psutil throws AccessDenied error when accessing something (maybe processes).
  • [x] psutil.sensors_temperatures is not available on MacOS. I was aware that this did not work on windows.
  • [x] The app freezes when removing the last stat that uses the process tracker.
  • [x] JS throws some errors in the native frontend. This happens when the stat is removed while the code to update the GUI is still running. These do not have real impact but I will (of course) fix them anyway (Cannot call method 'forEach' of undefined and Ignored NaN, Inf, or -Inf value. fall under this category).
  • [x] An EnvironmentError is thrown when installing some packages. That is very strange. I will have to further investigate it.

I managed to get an older version of MacOS running on my system, so I will be able to fix the errors myself. It would be great if you could verify it once they work on my machine though.

I'll track my progress here.

Edit: Errors shown in the GUI (such as the one that you saw when trying to add vRAM usage) are intended and just gracefully show that the respective stat is not available.

bminixhofer avatar Dec 10 '18 12:12 bminixhofer

The problems should be fixed now. permon browser might not work in Safari though. But that is another issue (#16). Can you verify that things are working now @NickFitton ?

bminixhofer avatar Dec 20 '18 17:12 bminixhofer