Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: I need help getting nvidia drivers installed and cuda and cudnn on Ubuntu 22.04

  1. #1
    Join Date
    Jan 2024
    Beans
    4

    I need help getting nvidia drivers installed and cuda and cudnn on Ubuntu 22.04

    Hello and thank you in advance,

    Below is the closest I could get to a formulaic presentation of my attempt to build up my system to begin engaging in machine learning after a fresh install of Ubuntu 22.04 LTS.

    If you can help me please let me know. I am still new to this so if you can continue my sequential install build with my notation it would be awesome.

    Also fact check this to make sure that I am using the best versions for everything.


    I have been at this for days. I have a Lenovo Legion y520. It has 32GB of RAM, a 1TB ssd, and an NVIDIA GeForce GTX 1050 ti with 4GB VRAM. I am trying to configure my computer for machine learning according to the following program.


    Code:
    I create a fresh install of Ubuntu 22.04.
    I select Ubuntu Pro for security and allow the software updater to update the software.
    
    
    **Install Google Chrome –**
    wget https://dl.google.com/linux/direct/g...rent_amd64.deb
    sudo dpkg -i google-chrome-stable_current_amd64.deb
    sudo apt --fix-broken install
    sudo apt update && sudo apt upgrade
    
    
    
    
    
    
    **Install DEAD SNAKES repository -**
    sudo apt install software-properties-common
    sudo add-apt-repository ppa:deadsnakes/ppa
    sudo apt update && sudo apt upgrade
    
    
    
    
    **Install PYTHON 3.12.1 -**
    sudo apt install python3.12
    sudo apt update && sudo apt upgrade
    
    
    
    
    
    
    **Install Git Repository -**
    sudo add-apt-repository ppa:git-core/ppa
    sudo apt update && sudo apt upgrade
    
    
    
    
    
    
    **Install Git CLI version 2.43.0 -**
    sudo apt install git
    sudo apt update && sudo apt upgrade
    sudo git –version
    
    
    
    
    
    
    **Install Curl 7.81.0 -**
    sudo apt update && sudo apt upgrade
    sudo apt install curl
    sudo curl --version
    
    
    
    
    
    
    **Install Homebrew -**
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    (echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/tsisaris/.bashrc
    eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
    sudo apt-get install build-essential
    sudo apt update && sudo apt upgrade
    
    
    
    
    
    
    **Install DBUS-X11 -**
    sudo apt-get install dbus-x11
    sudo apt update && sudo apt upgrade
    
    
    
    
    At this point everything is working just fine
    
    
    
    
    I then try to install the latest version of NVIDIA drivers for my particular GPU which is now a legacy card.
    
    
    I have attempted to use the ubuntu drivers tool but it installs the wrong driver.
    
    
    I go on NVIDIAS website and select the correct driver and download it.
    
    
    This happens to be NVIDIA-Linux-x86_64-535.146.02.run
    
    
    I want to update my driver to the latest possible version and install the latest versions of CUDA, CUDNN, and Pytorch that will work with my machine so that I can begin to study and practise machine learning.
    
    
    In my case it would seem that CUDA 11.8 and CUDNN 8.9.7 are the latest versions that will Work with Pytorch 2.1.1 and on my video card.
    
    
    
    
    This is where the problem comes in.
    
    
    
    
    After following almost every permutation and order of installation process and they all fail to update the driver because nvidia drm is in use?
    
    
    
    
    I finally try this procedure...
    
    
    
    
    **Switch to tty3 by pressing Ctl+Alt+F3 -**
    
    
    **Unload nvidia-drm before proceeding -**
    
    
    **Isolate multi-user.target -**
    sudo systemctl isolate multi-user.target
    
    
    **Note that nvidia-drm is currently in use -**
    lsmod | grep nvidia.drm
    
    
    **Unload nvidia-drm -**
    sudo modprobe -r nvidia-drm
    
    
    **Note that nvidia-drm is not in use anymore -**
    lsmod | grep nvidia.drm
    
    
    **Install Newest Nvidia GPU Drivers 535.146.02 -**
    cd ~/Downloads
    sudo chmod +x NVIDIA-Linux-x86_64-535.146.02.run
    sudo ./NVIDIA-Linux-x86_64-535.146.02.run
    
    
    
    
    I answer all prompts during installation. It still seems like there is come kind of conflict.
    I have to input the keyring key
    
    
    
    
    **When installation has finished, confirm that the new driver is installed**
    nvidia-smi
    
    
    I get that the Driver Version is 535.146.02 and the CUDA version is 12.2? I haven't even installed CUDA yet...
    
    
    **Start the GUI again -**
    sudo systemctl start graphical.target
    
    
    
    
    I now want to install CUDA
    
    
    
    
    **Switch to tty3 by pressing Ctl+Alt+F3 -**
    
    
    **Unload nvidia-drm before proceeding -**
    
    
    **Isolate multi-user.target -**
    sudo systemctl isolate multi-user.target
    
    
    **Note that nvidia-drm is currently in use -**
    lsmod | grep nvidia.drm
    
    
    **Unload nvidia-drm -**
    sudo modprobe -r nvidia-drm
    
    
    **Note that nvidia-drm is not in use anymore -**
    lsmod | grep nvidia.drm
    
    
    **Go to your download folder and run the cuda installation -**
    sudo dpkg -i cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb
    
    
    **Answer any prompts during installation -**
    
    
    **When installation has finished, confirm that the CUDA Version has been updated -**
    nvidia-smi
    
    
    
    
    I start to understand this less and less
    
    
    when I run the nvidia-smi command I get that the Driver Version is 535.146.02 and the CUDA version is 12.2?
    
    
    **I have to install the NVIDIA CUDA toolkit so that I can run nvcc --version -**
    sudo apt install nvidia-cuda-toolkit
    
    
    
    
    when I run the nvcc --version command I get this garbage...
    
    
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2021 NVIDIA Corporation
    Built on Thu_Nov_18_09:45:30_PST_2021
    Cuda compilation tools, release 11.5, V11.5.119
    Build cuda_11.5.r11.5/compiler.30672275_0
    
    
    Where does CUDA 11.5 come from? I installed CUDA 11.8 and in nvidia-smi it says CUDA version 12.2
    
    
    How can I go through all of this process without a hangup?
    
    
    I am sure that there is a bunch of broken garbage in my Ubuntu system now. I want a complete step by step method that corrects my code if necessary to finish installing CUDA 11.8 and CUDNN 8.9.7 without a hiccup and without creating a bunch of broken garbage...
    
    
    What am I missing?


    Thank you in advance,
    Shawn
    Last edited by oldfred; January 7th, 2024 at 04:23 PM. Reason: Please use Code Tags.

  2. #2
    Join Date
    Mar 2011
    Beans
    1,993

    Re: I need help getting nvidia drivers installed and cuda and cudnn on Ubuntu 22.04

    The nvidia-smi is just reporting that it supports up to CUDA 12.2, not that it is installed. Using the Nvidia driver from any other source than the standard repositories will likely fail upon a kernel or driver upgrade -- avoid that by just getting the Nvidia drivers installed first (535.129.03 probably), then use the .run script from Nvidia and reject the offer of Nvidia drivers. Override the system locations for bin and lib files too -- all that can go under cuda/lib and cuda/bin. You can keep a clean system, no mixing of random versions of libraries and drivers, and run whatever versions of whatever for your project. See
    https://askubuntu.com/questions/1077...077063#1077063
    https://askubuntu.com/questions/1219...244010#1244010

  3. #3
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: I need help getting nvidia drivers installed and cuda and cudnn on Ubuntu 22.04

    Please use Code tags on terminal or longer text output.
    Easy to add code tags with Forum's advanced editor and # icon.

    Do not know anything about most of what you installed.
    Generally newer users should not add ppas until dyou know system and if ppa is safe to use.

    You have to purge a driver, before installing a new driver or else you get conflicts.
    And do not install driver from nVidia with .run file, only install from Ubuntu repository.
    The nVidia search says this is correct driver: 535.146.02

    If you installed the .run version, use its instructions to remove it.

    Ubuntu should give you the same:

    #What is installed
    dkms status

    # list drivers available, same list as system settings, software updates, additional drivers or last tab
    ubuntu-drivers devices
    # or
    ubuntu-drivers devices | grep recommended


    sudo apt-get remove --purge nvidia-*
    sudo ubuntu-drivers devices
    sudo ubuntu-drivers autoinstall


    man mkinitramfs
    sudo update-initramfs -u
    or
    sudo update-initramfs -k all -c
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  4. #4
    Join Date
    Aug 2016
    Location
    Wandering
    Beans
    Hidden!
    Distro
    Xubuntu Development Release

    Re: I need help getting nvidia drivers installed and cuda and cudnn on Ubuntu 22.04

    I'm having a tough time wondering why deadsnakes was added?
    I can't for the life of me figure out why python3.12 is needed??
    If not careful it will render your system unable to update and upgrade.

    I'm on Noble and python3 is
    Code:
    python3 --version
    Python 3.11.7
    Since you asked:
    Also fact check this to make sure that I am using the best versions for everything.
    That's not always a good choice.
    EDIT: I would first learn that New can be the Desktop destroyer.
    Stable is the intended way to learn first.
    Last edited by 1fallen; January 7th, 2024 at 06:29 PM.
    With realization of one's own potential and self-confidence in one's ability, one can build a better world.
    Dalai Lama>>
    Code Tags | System-info | Forum Guide lines | Arch Linux, Debian Unstable, FreeBSD

  5. #5
    Join Date
    Apr 2011
    Location
    Mystletainn Kick!
    Beans
    13,610
    Distro
    Ubuntu

    Re: I need help getting nvidia drivers installed and cuda and cudnn on Ubuntu 22.04

    Where does CUDA 11.5 come from? I installed CUDA 11.8 and in nvidia-smi it says CUDA version 12.2
    nvidia-cuda-toolkit.
    You've mixed and matched packages from inside and outside of the Ubuntu ecosystem.
    The toolkit package depends on packages from within the Ubuntu ecosystem.
    Those packages are for version 11.5

    Unless you did more than what you posted, this part says you only added a repository source entry with the
    following command
    **Go to your download folder and run the cuda installation -**
    sudo dpkg -i cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb
    Not sure if you followed the rest that is required
    Code:
    wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
    sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
    wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb
    sudo dpkg -i cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb
    sudo cp /var/cuda-repo-ubuntu2204-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
    sudo apt-get update
    sudo apt-get -y install cuda
    Highlighted the only part you posted.
    Splat Double Splat Triple Splat
    Earn Your Keep
    Don't mind me, I'm only passing through.
    Once in a blue moon, I'm actually helpful
    .

  6. #6
    Join Date
    Jan 2024
    Beans
    4

    Re: I need help getting nvidia drivers installed and cuda and cudnn on Ubuntu 22.04

    I'm trying to reply to all of these for further help? Some of this was in what I posted? I was told to use the latest NVIDIA drivers for my card. I used the Ubuntu recommended drivers with the Ubuntu installation tool and they were not the ones that NVIDIA recommends... So I downloaded the current most up to date drivers directly from NVIDIA's website as I said. This is really where the issue exists. I had to do a manual install of the most recent driver which seems to be 535.146.02 as of today as per NVIDIA’s website… I need people to be very explicit here. Are you saying that I should ignore NVIDIA’s website and just use whatever the Ubuntu driver installation tool happens to install or recommend?


    Using the NVIDIA driver from any other source than the standard repositories


    (- what standard repositories? NVIDIA or Ubuntu? - CODE PLEASE... -)


    will likely fail upon a kernel or driver upgrade -- avoid that by just getting the Nvidia drivers installed first (535.129.03 probably) (– wrong number according to NVIDIA -)


    then use the .run script from Nvidia and reject the offer of Nvidia drivers.


    (- How? CODE PLEASE… -)


    Override the system locations for bin and lib files too -- all that can go under cuda/lib and cuda/bin.


    (- How? CODE PLEASE… -)




    Please use Code tags on terminal or longer text output.
    Easy to add code tags with Forum's advanced editor and # icon.



    (- I have no idea how to di this… -)


    The nVidia search says this is correct driver: 535.146.02


    (- Yes. I said this. This was the issue. I couldn’t just install that driver. It kept giving me errors… I spent hours using Bing Chat to try new things and when I would get an error I would cut and paste the error into Bing Chat for it to be analyzed. I ended up trying nearly all of this. Bing Chat would give me the code and direct me to forums and websites to verify it. Low and behold it was the same advice that was being given on the forums… -)


    Ubuntu should give you the same:

    #What is installed
    dkms status

    # list drivers available, same list as system settings, software updates, additional drivers or last tab
    ubuntu-drivers devices
    # or
    ubuntu-drivers devices | grep recommended


    sudo apt-get remove --purge nvidia-*
    sudo ubuntu-drivers devices
    sudo ubuntu-drivers autoinstall


    man mkinitramfs
    sudo update-initramfs -u
    or
    sudo update-initramfs -k all -c



    (- Nearly all of this code I got from Bing Chat and the forums and tried it multiple times in multiple ways to no avail… -)


    (- If python 3.11.7 is truly the best most stable version of python out then thank you. This was the kind of advice that I am looking for… -)


    (- In a similar manner I need to know that the combined relationship between CUDA, cuDNN, and Pytorch that is optimal for my machine. I read that I could do CUDA 11.8, cuDNN 8.9.7, and Pytorch 2.1.1. I also read that CUDA 12.2, cuDNN 8.9.7, and an older Pytorch 1.10.0 would be much better with this machine… How do I verify this? -)


    (- In fact, how do I answer this type of question in general? I want to install docker, nvidiacudatoolkit, nvidia container toolkit, conda, jupyter notebooks, and whatever other tools or toolkits that will be helpful. I want all of them to be compatible with each other but also the most efficient, fastest, most stable version of each that is 100% compatible with all of the other programs and toolkits… -)


    (- Given that I am functionally illiterate in most of the mumbo jumbo, I need step by step in baby steps that even a caveman using fist sized buttons could implement with minimal effort and error and maximal success… -)


    (- CODE PLEASE… -) (- CODE PLEASE… -) (- CODE PLEASE… -)


    Thank you for your help

  7. #7
    Join Date
    Aug 2016
    Location
    Wandering
    Beans
    Hidden!
    Distro
    Xubuntu Development Release

    Re: I need help getting nvidia drivers installed and cuda and cudnn on Ubuntu 22.04

    To try to explain "standard repositories" means all software is tuned so to speak for Ubuntu already configured by the installer.
    ie:
    Code:
    Active apt repos in: /etc/apt/sources.list
        1: deb http://archive.ubuntu.com/ubuntu noble main restricted
        2: deb http://archive.ubuntu.com/ubuntu noble-updates main restricted
        3: deb http://archive.ubuntu.com/ubuntu noble universe
        4: deb http://archive.ubuntu.com/ubuntu noble-updates universe
        5: deb http://archive.ubuntu.com/ubuntu noble multiverse
        6: deb http://archive.ubuntu.com/ubuntu noble-updates multiverse
        7: deb http://archive.ubuntu.com/ubuntu noble-backports main restricted universe multiverse
        8: deb http://archive.ubuntu.com/ubuntu noble-security main restricted
        9: deb http://archive.ubuntu.com/ubuntu noble-security universe
       10: deb http://archive.ubuntu.com/ubuntu noble-security multiverse
    Now this is outside of the standard repo sources:
    Code:
     Active apt repos in: /etc/apt/sources.list.d/archive_uri-https_download_sublimetext_com_-noble.list
        1: deb https://download.sublimetext.com/ apt/stable/
      Active apt repos in: /etc/apt/sources.list.d/surfshark.list
        1: deb https://ocean.surfshark.com/debian stretch main
      Active apt repos in: /etc/apt/sources.list.d/cubic-wizard-ubuntu-release-noble.sources
        1: deb https://ppa.launchpadcontent.net/cubic-wizard/release/ubuntu/ noble main
      Active apt repos in: /etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa-noble.sources
        1: deb https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu/ noble main
      Active apt repos in: /etc/apt/sources.list.d/mozillateam-ubuntu-ppa-noble.sources
        1: deb https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu/ noble main
      Active apt repos in: /etc/apt/sources.list.d/ubuntuhandbook1-ubuntu-conkymanager2-noble.sources
        1: deb https://ppa.launchpadcontent.net/ubuntuhandbook1/conkymanager2/ubuntu/ jammy main
    All Standard Repo's will look like "archive.ubuntu.com/ubuntu"
    And ppa are considered a gamble because the code dose not come from Ubuntu Devs.

    IMPORTANT: Learn to use code tags for Terminal results, please see my signature for Code Tags
    Also please show me this:
    Code:
    apt policy nvidia-driver-535
    With realization of one's own potential and self-confidence in one's ability, one can build a better world.
    Dalai Lama>>
    Code Tags | System-info | Forum Guide lines | Arch Linux, Debian Unstable, FreeBSD

  8. #8
    Join Date
    Jan 2024
    Beans
    4

    Re: I need help getting nvidia drivers installed and cuda and cudnn on Ubuntu 22.04

    Why is it that I get this -

    sudo apt-cache policy nvidia-driver-535
    [sudo] password for tsisaris:
    nvidia-driver-535:
    Installed: 535.129.03-0ubuntu0.22.04.1
    Candidate: 535.129.03-0ubuntu0.22.04.1
    Version table:
    *** 535.129.03-0ubuntu0.22.04.1 500
    500 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages
    500 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages
    100 /var/lib/dpkg/status

    and I get this

    nvidia-smi
    Sun Jan 7 16:39:31 2024
    +---------------------------------------------------------------------------------------+
    | NVIDIA-SMI 535.146.02 Driver Version: 535.146.02 CUDA Version: 12.2 |
    |-----------------------------------------+----------------------+----------------------+
    | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
    | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
    | | | MIG M. |
    |=========================================+======= ===============+======================|
    | 0 NVIDIA GeForce GTX 1050 Ti Off | 00000000:01:00.0 Off | N/A |
    | N/A 33C P8 N/A / ERR! | 4MiB / 4096MiB | 0% Default |
    | | | N/A |
    +-----------------------------------------+----------------------+----------------------+

    +---------------------------------------------------------------------------------------+
    | Processes: |
    | GPU GI CI PID Type Process name GPU Memory |
    | ID ID Usage |
    |================================================= ======================================|
    | 0 N/A N/A 1725 G /usr/lib/xorg/Xorg 4MiB |
    +---------------------------------------------------------------------------------------+

    I want to know how to start over with a fresh installation of Ubuntu 22.04 LTS and add these things in an exact order where I get no conflicts.

    I still need to know which are the best versions of cuda, cudnn, and pytorch to use together with this machine.

  9. #9
    Join Date
    Aug 2016
    Location
    Wandering
    Beans
    Hidden!
    Distro
    Xubuntu Development Release

    Re: I need help getting nvidia drivers installed and cuda and cudnn on Ubuntu 22.04

    Quote Originally Posted by tsisaris View Post

    I still need to know which are the best versions of cuda, cudnn, and pytorch to use together with this machine.
    Again it's best to keep a uniform software base intact hence "Standard Repository"
    You show two different drivers because apt only reads from again the above "Standard Repository"
    And you have the nVidia driver from nvidia. Also the cause of your troubles is that two drivers are installed not a good practice.

    I say this in all kindness, you first need to learn to walk your system, before unleashing a full gallop.
    With realization of one's own potential and self-confidence in one's ability, one can build a better world.
    Dalai Lama>>
    Code Tags | System-info | Forum Guide lines | Arch Linux, Debian Unstable, FreeBSD

  10. #10
    Join Date
    Jan 2024
    Beans
    4

    Re: I need help getting nvidia drivers installed and cuda and cudnn on Ubuntu 22.04

    I don't believe that trying to install the correct driver for my card is a full gallop... I'd say it's more like sleeping and breathing... It's probably the most basic thing that you are supposed to do recommended by the manufacturer of the card. It's supposed to be super simple. It's really hard to believe that Ubuntu just doesn't understand how to install the correct fiver for my card. I there must be something that I'm doing wrong but even when I follow peoples exact advice it doesn't seem to work. I'll keep trying. If anyone has the complete set of code that can purge my old drivers and install the new ones I would appreciate it... And yes I followed exactly the steps on NVIDIA's website... I don't mind a complete reinstall. It was my intention to do so once I had the proper process. I just don't want to keep reinstalling over and over. Thank you, Shawn

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •