Score:0

How to properly install NVIDIA RTX drivers in Ubuntu 22.04 LTS?

ne flag

I have bought a gaming laptop with GPU RTX 3050 mobile. And since I want to use it for machine learning and deep learning stuff, I want to make sure that I've proper access to its graphics card.

Till now, I've tried :

ubuntu-drivers devices

And then :

sudo ubuntu-drivers autoinstall

and it gave me this error:

    Traceback (most recent call last):
  File "/usr/bin/ubuntu-drivers", line 513, in <module>
    greet()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/bin/ubuntu-drivers", line 432, in autoinstall
    command_install(config)
  File "/usr/bin/ubuntu-drivers", line 187, in command_install
    UbuntuDrivers.detect.nvidia_desktop_pre_installation_hook(to_install)
  File "/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py", line 839, in nvidia_desktop_pre_installation_hook
    with_nvidia_kms = version >= 470
UnboundLocalError: local variable 'version' referenced before assignment
Score:0
ru flag

I had the same problem. My solution was to edit detect.py Commands

sudo gedit /usr/lib/python3/dist-packages/UbuntuDrivers/detect.py

Then scroll to line 835.

Change that line of code to

version = int(package_name.split('-')[-2])

Save and close your file. You may also want to reboot.

Apparently, it is a bug because some drivers ends with a word instead of an integer. Ec. driver-name-525-open. This code adjustment takes the 525 integer value.

cc flag
Or just use the non "-open" version of the driver.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.