Coder Social home page Coder Social logo

Comments (10)

Ricks-Lab avatar Ricks-Lab commented on August 29, 2024 1

I did a proof of concept for this that worked. I need to work out a more robust solution after I complete work on release of v3.8.0. Might be a few weeks before I get to it.

from gpu-utils.

Ricks-Lab avatar Ricks-Lab commented on August 29, 2024

Thanks for the suggestion. Let me take a look at it after I get things ready for next Debian release.

from gpu-utils.

min-xu-ai avatar min-xu-ai commented on August 29, 2024

Thank you so much! I can help test it when you have it. I have a system with bare minimal linux install, which doesn't have the needed libraries for gui.

from gpu-utils.

Ricks-Lab avatar Ricks-Lab commented on August 29, 2024

I have a working version on the gtk_optional branch. Let me know of any issues.

from gpu-utils.

min-xu-ai avatar min-xu-ai commented on August 29, 2024

Cool. I tried on my system. Here is the diff I needed to make it work:

diff --git a/gpu-mon b/gpu-mon
index 8b291d0..0366535 100755
--- a/gpu-mon
+++ b/gpu-mon
@@ -65,8 +65,9 @@ try:
     import gi
     gi.require_version('Gtk', '3.0')
     from gi.repository import GLib, Gtk
+    from GPUmodules import GPUgui
     GTK = True
-except ModuleNotFoundError as error:
+except (ModuleNotFoundError, ValueError) as error:
     print('gi import error: {}'.format(error))
     print('gi is required for {}'.format(__program_name__))
     print('   In a venv, first install vext:  pip install --no-cache-dir vext')
@@ -74,7 +75,6 @@ except ModuleNotFoundError as error:
     GTK = False

 from GPUmodules import __version__, __status__, __credits__
-from GPUmodules import GPUgui
 from GPUmodules import GPUmodule as Gpu
 from GPUmodules import env

The ValueError is from gi.require_version() line since gi could be install but underlying gtk module can be not there. without it, the error is:

Traceback (most recent call last):
  File "/home/owen/e/py39/bin/gpu-mon", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/home/owen/git/gpu-utils/gpu-mon", line 66, in <module>
    gi.require_version('Gtk', '3.0')
  File "/home/owen/miniconda39/lib/python3.9/site-packages/gi/__init__.py", line 126, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available

from gpu-utils.

Ricks-Lab avatar Ricks-Lab commented on August 29, 2024

Can you make a pull request with the modifications? Probably need to skip GPUgui import only if GTK is false.

from gpu-utils.

min-xu-ai avatar min-xu-ai commented on August 29, 2024

Sure. See #135. I just moved the GPUgui import into the same try statement. That should be the same, right?

from gpu-utils.

Ricks-Lab avatar Ricks-Lab commented on August 29, 2024

Looks good! I made another change to simplify the if GTK logic. Also, I updated credits to indicate your contribution. Let me know of any concerns.

from gpu-utils.

min-xu-ai avatar min-xu-ai commented on August 29, 2024

Thanks!

from gpu-utils.

Ricks-Lab avatar Ricks-Lab commented on August 29, 2024

Enhancement is complete and will be released as a package in v3.8.1. Need to delay this to support v3.8.0 official Debian package release.

from gpu-utils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.