Slimbook-Team / slimbookamdcontroller

GNU General Public License v3.0
35 stars 8 forks source link

"name not defined" error at launch #30

Open edogawa23 opened 1 year ago

edogawa23 commented 1 year ago

This is the error and python traceback I get (trying both from source directory and my installed rpm binary, via terminal):

Traceback (most recent call last): File "/usr/bin/slimbookamdcontroller", line 35, in from slimbookamdcontroller import SlimbookAMD File "/usr/share/slimbookamdcontroller/src/slimbookamdcontroller.py", line 6, in from sections.gpu_section import GpuSection File "/usr/share/slimbookamdcontroller/src/sections/gpu_section.py", line 21, in class GpuSection(): File "/usr/share/slimbookamdcontroller/src/sections/gpu_section.py", line 150, in GpuSection def __render_chart(self, gpu: GpuService) -> FigureCanvas: NameError: name 'GpuService' is not defined

Interestingly, if my memory doesn't play tricks, I was able to run it on my older ASUS i5 laptop, back when creating/testing the rpm ... I'll check that again soon, right now I'm short of time

katsuja commented 1 year ago

Instead, I get the following error: $slimbookamdcontroller /usr/share/slimbookamdcontroller/src Traceback (most recent call last): File "/usr/bin/slimbookamdcontroller", line 35, in from slimbookamdcontroller import SlimbookAMD File "/usr/share/slimbookamdcontroller/src/slimbookamdcontroller.py", line 34, in type = patron.search(cpu).group(1).strip() ^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'group'

OS: Arch Linux x86_64 Host: Surface Laptop 4 124I:00055T:000M:0200000B Kernel: Linux 6.3.4-arch1-1-surface GPU Driver: amdgpu CPU: AMD Ryzen 5 Microsoft Surface Edition (12) GPU: AMD ATI 03:00.0 Renoir

$cpupower frequency-info analisi della CPU 9: driver: amd-pstate CPU che operano alla stessa frequenza hardware: 9 CPU che è necessario siano coordinate dal software: 9 latenza massima durante la transizione: 20.0 us limiti hardware: 400 MHz - 2.20 GHz gestori disponibili: conservative ondemand userspace powersave performance schedutil gestore attuale: la frequenza deve mantenersi tra 400 MHz e 1.10 GHz. Il gestore "powersave" può decidere quale velocità usare in questo intervallo. current CPU frequency: Unable to call hardware current CPU frequency: 404 MHz (asserted by call to kernel) boost state support: Supported: yes Active: no AMD PSTATE Highest Performance: 255. Maximum Frequency: 4.01 GHz. AMD PSTATE Nominal Performance: 140. Nominal Frequency: 2.20 GHz. AMD PSTATE Lowest Non-linear Performance: 71. Lowest Non-linear Frequency: 1.12 GHz. AMD PSTATE Lowest Performance: 26. Lowest Frequency: 400 MHz.

MarSlimbook commented 1 year ago

Hi @katsuja does this command work in your os?

cat /proc/cpuinfo | grep name | uniq

MarSlimbook commented 1 year ago

@edogawa23 I think it's not importing class GpuService correctly, but I'm not sure why, here is the line: https://github.com/Slimbook-Team/slimbookamdcontroller/blob/bea20f4de267855315cae7c0724fe6a690dd961f/src/sections/gpu_section.py#L15

To make sure this is the error, you can edit that try / except this way:

try:
    from services.gpu_service import GpuService
except NameError:
    print(NameError)
    pass

If when you init the app (via terminal) the error is printed, tell me, and maybe check src/services/gpu_service.py file and directory's permissions. PD: Thank you so much for building RPM packages of our apps!

edogawa23 commented 1 year ago

Aha, this clears it up, the error printed is this:

Traceback (most recent call last): File "/home/ed/src/slimbookamdcontroller/src/slimbookamdcontroller.py", line 6, in from sections.gpu_section import GpuSection File "/home/ed/src/slimbookamdcontroller/src/sections/gpu_section.py", line 15, in from services.gpu_service import GpuService File "/home/ed/src/slimbookamdcontroller/src/services/gpu_service.py", line 1, in import pyamdgpuinfo ModuleNotFoundError: No module named 'pyamdgpuinfo'

After installing this via "pip install pyamdgpuinfo", The GUI launches. This is not available from any OBS (distro, community or 3rdparty) repos for openSUSE. So ideally, I'll build a package of this as well, to have all the runtime dependencies available from the package manager.

Not sure when I will find time to do that, though.

edogawa23 commented 1 year ago

Testing the app now, I see ryzenadj needs to be installed, which is missing in any "official" openSUSE distro but available in OBS "hardware" community repo. I'll see what I can do to get it included in the distro along with slimbook apps, once I'm happy with my packaging.

katsuja commented 1 year ago

Hi @katsuja does this command work in your os?

cat /proc/cpuinfo | grep name | uniq

Hi @MarSlimbook cat /proc/cpuinfo | grep name | uniq model name : AMD Ryzen 5 Microsoft Surface (R) Edition

slimbook commented 1 year ago

So ideally, I'll build a package of this as well, to have all the runtime dependencies available from the package manager.

Awesome! We could also build a .deb package of this python package to add it as a dependency in the control file some day.

slimbook commented 1 year ago

model name : AMD Ryzen 5 Microsoft Surface (R) Edition

Some changes should be made to the app to support this kind of processor name, it's unsupported for the time being... As I've seen in the specifications it might be an:

AMD Ryzen 5 4680U Mobile Processor with Radeon™ Graphics Microsoft Surface Edition (6 cores)

We usually set parameters based on cpu power suffix, we should do some research to add this kind of processors.

edogawa23 commented 1 year ago

So ideally, I'll build a package of this as well, to have all the runtime dependencies available from the package manager.

Awesome! We could also build a .deb package of this python package to add it as a dependency in the control file some day.

Here it is: https://build.opensuse.org/package/show/home:edogawa/python-pyamdgpuinfo

You can branch my package, do the debian packages and submit back to me or make your branch independent from my package via osc detachbranch, all fine with me.

With this and ryzenadj installed, slimbookamdcontroller is up and running. One thing that I still cannot get to work is to add the icon to the kde systray. I've started comparing the relevant code with that of slimbookbattery which looks very similar and works. I haven't found anything so far and now am too busy in my day job to continue, so this has to wait currently.

edogawa23 commented 1 year ago

Interestingly, if my memory doesn't play tricks, I was able to run it on my older ASUS i5 laptop, back when creating/testing the rpm ... I'll check that again soon, right now I'm short of time

oh I checked and of course, on that laptop, it was slimbookintelcontroller that I had got running...

jcarolinares commented 3 weeks ago

Hello, same error

Ubuntu distributio, the original one from Slimbook I must say, Slimbook Titan

jcarolinares@jcarolinares-TITAN:~$ slimbookamdcontroller
/usr/share/slimbookamdcontroller/src
Traceback (most recent call last):
  File "/usr/bin/slimbookamdcontroller", line 35, in <module>
    from slimbookamdcontroller import SlimbookAMD
  File "/usr/share/slimbookamdcontroller/src/slimbookamdcontroller.py", line 6, in <module>
    from sections.gpu_section import GpuSection
  File "/usr/share/slimbookamdcontroller/src/sections/gpu_section.py", line 21, in <module>
    class GpuSection():
  File "/usr/share/slimbookamdcontroller/src/sections/gpu_section.py", line 150, in GpuSection
    def __render_chart(self, gpu: GpuService) -> FigureCanvas:
NameError: name 'GpuService' is not defined

It would be great to know the reason and have some patch if possible

jcarolinares commented 2 weeks ago

Hello, same error

Ubuntu distributio, the original one from Slimbook I must say, Slimbook Titan

jcarolinares@jcarolinares-TITAN:~$ slimbookamdcontroller
/usr/share/slimbookamdcontroller/src
Traceback (most recent call last):
  File "/usr/bin/slimbookamdcontroller", line 35, in <module>
    from slimbookamdcontroller import SlimbookAMD
  File "/usr/share/slimbookamdcontroller/src/slimbookamdcontroller.py", line 6, in <module>
    from sections.gpu_section import GpuSection
  File "/usr/share/slimbookamdcontroller/src/sections/gpu_section.py", line 21, in <module>
    class GpuSection():
  File "/usr/share/slimbookamdcontroller/src/sections/gpu_section.py", line 150, in GpuSection
    def __render_chart(self, gpu: GpuService) -> FigureCanvas:
NameError: name 'GpuService' is not defined

It would be great to know the reason and have some patch if possible

Additional info

Partial solution from @edogawa23 works in my slimbook titan:

pip install pyamdgpuinfo

would be great to add the dependency to the installer