Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimus-manager cannot be loaded #541

Closed
pnedyalkov91 opened this issue May 2, 2023 · 18 comments
Closed

optimus-manager cannot be loaded #541

pnedyalkov91 opened this issue May 2, 2023 · 18 comments

Comments

@pnedyalkov91
Copy link

pnedyalkov91 commented May 2, 2023

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

  • Arch Linux
  • KDE Plasma 5.27.4
  • SDDM
  • Lenovo Legion Y540
  • optimus-manager 1.4-4.1 (installed from pacman)

Logs

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

@WouterSpekkink
Copy link

WouterSpekkink commented May 4, 2023

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
Copy link

staust commented May 4, 2023

I faced the same issue and was able to solve it by rebuilding the package with the new python version (3.11) following this:
#272 (comment)

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

@pnedyalkov91
Copy link
Author

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
Copy link

staust commented May 4, 2023

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
Copy link

WouterSpekkink commented May 4, 2023

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
Copy link

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

@WouterSpekkink
Copy link

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
Copy link
Author

pnedyalkov91 commented May 4, 2023

@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
Copy link

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
Copy link

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

  • Uninstall optimus-manager and remove it from the pacman cache.
  • Use yay to install optimus-manager from AUR.

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
Copy link

aidasbui commented May 4, 2023

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 #541 (comment)

@ffarps
Copy link

ffarps commented May 5, 2023

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
Copy link

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
Copy link

PunkUnity commented May 13, 2023

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
Copy link

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
Copy link

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
Copy link

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
Copy link
Collaborator

nwildner commented Jul 1, 2024

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.

@nwildner nwildner closed this as completed Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests