rbonghi / jetson_stats

📊 Simple package for monitoring and control your NVIDIA Jetson [Orin, Xavier, Nano, TX] series
https://rnext.it/jetson_stats
GNU Affero General Public License v3.0
2.17k stars 264 forks source link

does not find tegrastats despite its installed #38

Closed ardupython closed 4 years ago

ardupython commented 5 years ago

tegrastats is installed under a custom user, which is also the main user running the program. Tegrastats is located in "/usr/sbin/tegrastats" and can be executed from the commandline as "tegrastats".

But the output of jtop only shows "Tegrastats is not availabe on this board".

If the paths in the TEGRASTATS variable are changed, jtop crashes.

Changing the paths from

# List of available fan
    JTOP_FOLDER = '/opt/jetson_stats/'
    LIST_FANS = [('/sys/kernel/debug/tegra_fan/', False), ('/sys/devices/pwm-fan/', True)]
    TEGRASTATS = ['/usr/bin/tegrastats', '/home/nvidia/tegrastats']

to the current path

# List of available fan
    JTOP_FOLDER = '/opt/jetson_stats/'
    LIST_FANS = [('/sys/kernel/debug/tegra_fan/', False), ('/sys/devices/pwm-fan/', True)]
    TEGRASTATS = ['/usr/sbin/tegrastats']

crashes the program

dist-pacuser@vm:/usr/local/lib/python3.5/dist-packages/jtop$ sudo jtop
Traceback (most recent call last):
  File "/usr/local/bin/jtop", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/dist-packages/jtop/__main__.py", line 62, in main
    curses.wrapper(JTOPGUI, args.refresh, jetson, [ALL, GPU, CTRL, INFO], init_page=args.page)
  File "/usr/lib/python3.5/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/local/lib/python3.5/dist-packages/jtop/gui/jtopgui.py", line 78, in __init__
    self.run()
  File "/usr/local/lib/python3.5/dist-packages/jtop/gui/jtopgui.py", line 99, in run
    self.draw()
  File "/usr/local/lib/python3.5/dist-packages/jtop/gui/jtopguilib.py", line 71, in wrapped
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/jtop/gui/jtopgui.py", line 110, in draw
    page.draw(self.key)
  File "/usr/local/lib/python3.5/dist-packages/jtop/gui/pall.py", line 43, in draw
    line_counter = plot_CPUs(self.stdscr, line_counter, self.jetson.stats['CPU'], width)
  File "/usr/local/lib/python3.5/dist-packages/jtop/gui/jtopguilib.py", line 107, in wrapped
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/jtop/gui/jtopguimenu.py", line 48, in plot_CPUs
    return int(offest + idx + 1)
UnboundLocalError: local variable 'idx' referenced before assignment
rbonghi commented 5 years ago

Hi @ardupython ,

Thank you for your issue, but which board are you using? jtop automatically find the first tegrastats available in TEGRASTATS and is not require to modify the code :-)

  • Does jtop use only the path defined in jtop.py or are there other paths defined else where?

Follow only the paths defined in jtop.py. Usually tegrastats, jetson_clocks and the fan are available only there when you use an NVIDIA Jetson

  • Is there an option to point it to the tegrastats path besides the TEGRASTATS variable in jtop.py ?

At this time is not available. Do you have another distribution on your jetson?

ardupython commented 5 years ago

Thanks for the great software tool. I try to run it on ubuntu 16.04 on a nvidia TX2 Jetson board. Tegrastats is added to path and can be started directly from the command line, just "tegrastats" with or without sudo. If i use the default paths, which are defined in "jtop.py", tegrastats is not found. As mentioned above, its located in "/usr/sbin/tegrastats", which is not part of the standard paths in "jtop.py".

Are there maybe other environmental variables that could affect it?

rbonghi commented 5 years ago

With this different configuration I never tried, but without change the code you can try:

Are there maybe other environmental variables that could affect it?

No, should work fine

I see in your crash you are using this hostname

dist-pacuser@vm

Are you working on virtual machine? The name look like that