Askannz / optimus-manager

A Linux program to handle GPU switching on Optimus laptops.
MIT License
2.25k stars 165 forks source link

optimus-manager cannot be loaded #541

Closed pnedyalkov91 closed 3 days ago

pnedyalkov91 commented 1 year ago

Describe the bug After rebooting Arch Linux, SDDM doesn't start and the screen is black. Yesterday there were some updates like Python to 3.11.3 and Linux kernel 6.3.1. Logs are attached to the issue ticket.

System info

Logs

optimus-manager status log.txt optimus-manager systemctl status.txt

WouterSpekkink commented 1 year ago

I think I have a similar issue. I just updated, with a lot of python updates. I am actually able to boot normally, but when I try to switch to my Nvidia card with optimus-manager, I get the following Traceback:

Traceback (most recent call last):
  File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 563, in from_name
    return next(cls.discover(name=name))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/optimus-manager", line 33, in <module>
    sys.exit(load_entry_point('optimus-manager==1.4', 'console_scripts', 'optimus-manager')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/optimus-manager", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
                       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 981, in distribution
    return Distribution.from_name(distribution_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 565, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for
optimus-manager
staust commented 1 year ago

I faced the same issue and was able to solve it by rebuilding the package with the new python version (3.11) following this: https://github.com/Askannz/optimus-manager/issues/272#issuecomment-1010192798

yay -S $(pacman -Qoq /usr/lib/python3.10) --answerclean All

pnedyalkov91 commented 1 year ago

Thank you @staust I rebuilt with Python version 3.10 (yay -S $(pacman -Qoq /usr/lib/python3.10) --answerclean All) but the same issue.

staust commented 1 year ago

Thank you @staust I rebuilt with Python version 3.10 (yay -S $(pacman -Qoq /usr/lib/python3.10) --answerclean All) but the same issue.

Just to make sure: This does not rebuild the optimus package with python 3.10. pacman -Qoq /usr/lib/python3.10 returns all packages which owned this specific python version. Maybe you used an other python version before.

Basicly what should help is: yay -S optimus-manager --answerclean All

WouterSpekkink commented 1 year ago

Yes, thank you @staust, but also for me this problem persists after following your suggestion, also when using /usr/lib/python3.11.

Update: Okay, I found out what the issue was in my case. I installed my system a long time ago using an installer from one of the arcolinux distributions. Even though I kinda stripped most of the arcolinux stuff away since then, I still have their repositories in my list, and optimus-manager was installed from one of their repos instead of the AUR. This apparently means that the package does not actually get rebuilt when using the suggested command.

I uninstalled the arcolinux version and reinstalled using the AUR and now it works fine again. Thanks again for the suggestion @staust!

username227 commented 1 year ago

Same issue here. Using arch/cinnamon. Couldn't even get graphical interface of lightdm with optimum-manager installed after python 3.11 upgrade.

WouterSpekkink commented 1 year ago

Same issue here. Using arch/cinnamon. Couldn't even get graphical interface of lightdm with optimum-manager installed after python 3.11 upgrade.

Have you tried @staust's suggested fix? I think the core of the issue is that your installed version of optimum-manager will be built against an earlier version of python, so the trick is to rebuild it against the updated version. If you cannot even get in the ligthdm or sddm login interface, you'll have to boot into command line mode (I am not sure that this is actually the correct terminology), as described here: https://www.baeldung.com/linux/boot-linux-command-line-mode.

pnedyalkov91 commented 1 year ago

@staust , @WouterSpekkink Thank you very much for the suggested fix! My problem was the package comes from chaotic-aur by default. I deleted it and did a clean build from AUR and install optimus-manager from there. It is working! Thank you guys a lot!

username227 commented 1 year ago

Same issue here. Using arch/cinnamon. Couldn't even get graphical interface of lightdm with optimum-manager installed after python 3.11 upgrade.

Have you tried @staust's suggested fix? I think the core of the issue is that your installed version of optimum-manager will be built against an earlier version of python, so the trick is to rebuild it against the updated version. If you cannot even get in the ligthdm or sddm login interface, you'll have to boot into command line mode (I am not sure that this is actually the correct terminology), as described here: https://www.baeldung.com/linux/boot-linux-command-line-mode.

Yeah, so I tried that command above, but it didn't work. It must've been automatically installing the package from the cache (which I cleared but it didn't make a difference) or the chaotic repository even though I specified AUR.

I solved by downloading the pkgbuild from the aur websites manually, building, and installing with pacman -U. But I would rather not have to do it this way if you have any ideas.

WouterSpekkink commented 1 year ago

You've probably done the following already, but just to be sure, I think the following should work:

I actually think that this should probably be enough? I am not 100% sure about any of this, but I think this works because yay not only downloads the package but also (re)builds it. I assume the problem with optimus-manager is caused by it being built against Python, which has been updated to 3.11. The version you currently have running was built against 3.10 (or even an earlier version of Python?). I tried reinstalling optimus-manager from another repository (an arcolinux one in my case), but apparently this does not actually rebuild the package, while installing it from the AUR, using yay, does? Again, I am not 100% that this is actually the case.

aidasbui commented 1 year ago

yay -S optimus-manager --answerclean All

Fixed! Thank you very much @staust, saved me quite some time.

I noticed the huge amount of python package updates today, but the issue appeared only when I made a few changes to my Arch system many hours later and rebooted. Took me a while to get to the culprit, which was the same as https://github.com/Askannz/optimus-manager/issues/541#issuecomment-1534227263

ffarps commented 1 year ago

I've encountered the same issue. in my system I resolve doing this:

sudo pacman -R optimus-manager optimus-manager-qt-git
sudo pacman -Sc
paru -Sc
yay -Sc
yay -S optimus-manager optimus-manager-qt-git

(yes I have both, but manly I use paru)

HydroCarbon commented 1 year ago

470xx and older drivers may not function correctly on Linux 5.18 (or later) on systems with Intel CPUs 11th Gen and newer due an incompatibility with Indirect Branch Tracking. You can disable it by setting the ibt=off kernel parameter from the boot loader. Be aware, this security feature is responsible for mitigating a class of exploit techniques.

PunkUnity commented 1 year ago

I am still having this issue even after running all these steps. Uninstalled optimus-manager-git and optimus-manager-git-qt. Cleaned pacman, trizen, yay cache. Reinstalled both applications. Ran yay -S optimus-manager --answerclean All. I still get this error... optimus-manager --print Traceback (most recent call last): File "/usr/lib/python3.11/importlib/metadata/init.py", line 563, in from_name return next(cls.discover(name=name)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/bin/optimus-manager", line 33, in sys.exit(load_entry_point('optimus-manager==1.4', 'console_scripts', 'optimus-manager')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/bin/optimus-manager", line 22, in importlib_load_entry_point for entry_point in distribution(dist_name).entry_points ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/importlib/metadata/init.py", line 981, in distribution return Distribution.from_name(distribution_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/importlib/metadata/init.py", line 565, in from_name raise PackageNotFoundError(name) importlib.metadata.PackageNotFoundError: No package metadata was found for optimus-manager Quick edit. I have tried installing just optimus-manager and not optimus-manager-git but it does not exist for me. I usually use trizen.

codemaker4 commented 1 year ago

Same issue, black screen on boot after paru/pacman update with the above errors. ffarps' solution worked for me:

paru -R optimus-manager optimus-manager-qt
paru -Sc
paru -S optimus-manager optimus-manager-qt

After the last command it does indeed rebuild it, and simply rebooting afterwards fully recovered my system. Thanks ffarps!

serranomorante commented 1 year ago

I've encountered the same issue. in my system I resolve doing this:

sudo pacman -R optimus-manager optimus-manager-qt-git
sudo pacman -Sc
paru -Sc
yay -Sc
yay -S optimus-manager optimus-manager-qt-git

(yes I have both, but manly I use paru)

For those like me that are using pyenv

None of the previous options worked until I changed my global python version first.

# Running this
pyenv which python

# has to give you this result
/usr/bin/python

# if it doens't, then run this command
pyenv global system

# and check again...
pixelsnbits commented 10 months ago

I've encountered the same issue. in my system I resolve doing this:

sudo pacman -R optimus-manager optimus-manager-qt-git
sudo pacman -Sc
paru -Sc
yay -Sc
yay -S optimus-manager optimus-manager-qt-git

(yes I have both, but manly I use paru)

For those like me that are using pyenv

None of the previous options worked until I changed my global python version first.

# Running this
pyenv which python

# has to give you this result
/usr/bin/python

# if it doens't, then run this command
pyenv global system

# and check again...

Setting pyenv global system was the key as I use pyenv for development environments. Running all the cache clearing and re-install commands worked successfully after setting this!

nwildner commented 1 week ago

Sup @PunkUnity . Is this still an issue to you?

In my case it got solved by using optimus-manager-git from AUR and updating to python-3.12.

Since this issue isn't active for the last year and a lot has changed in many aspects of multiple software, we'll keep this case opened for some days and close it if no further comments are provided. We're dealing with backlog here to try to keep optimus-manager in a good shape and active as a project.

Have a nice week ahead.