Issues while installing CUDA 10.1 and nvidia-driver in Ubuntu 18.04

9,677

Solution 1

Installing CUDA from runfile is much simpler and smoother than installing the NVIDIA driver. It just involves copying files to system directories and has nothing to do with the system kernel or online compilation. Removing CUDA is simply removing the installation directory. So I personally does not recommend adding NVIDIA's repositories and install CUDA via apt-get or other package managers as it will not reduce the complexity of installation or uninstallation but increase the risk of messing up the configurations for repositories.

The CUDA runfile installer can be downloaded from NVIDIA's websie. But what you download is a package the following three components:

  1. an NVIDIA driver installer, but usually of stable version;
  2. the actual CUDA installer;
  3. the CUDA samples installer;

To extract above three components, one can execute the runfile installer with --extract option. Then, executing the second one will finish the CUDA installation. Installation of the samples are also recommended because useful tool such as deviceQuery and p2pBandwidthLatencyTest are provided.

Scripts for installing CUDA Toolkit are summarized below.

cd ~
wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run
chmod +x cuda_7.5.18_linux.run
./cuda_7.5.18_linux.run --extract=$HOME
sudo ./cuda-linux64-rel-7.5.18-19867135.run

After the installation finishes, configure runtime library.

sudo bash -c "echo /usr/local/cuda/lib64/ > /etc/ld.so.conf.d/cuda.conf"
sudo ldconfig

It is also recommended for Ubuntu users to append string /usr/local/cuda/bin to system file /etc/environments so that nvcc will be included in $PATH. This will take effect after reboot.

Source here

Solution 2

It's due to using NVidia's cuda repo. That repo has an updated cuda and driver version, but only for amd64. The main Ubuntu repository provides i386 versions, but only up to 440 for now. You don't need the i386 versions for doing machine learning applications, only for playing games on steam (or similar). If you're happy not to play games on that machine, then just remove the i386 versions. Eventually, the main Ubuntu repos will update to 450 too and you can reinstall the i386 versions if you want.

Solution 3

This is not a proper answer on how to install it, but to get rid of those warnings before trying a different installation method, I used:

sudo apt-get remove –f

sudo apt-get clean

sudo apt-get autoremove

I am going to try this other method afterwards: https://www.pugetsystems.com/labs/hpc/How-To-Install-CUDA-10-1-on-Ubuntu-19-04-1405/

Good luck.

Share:
9,677
Aditya Kandekar
Author by

Aditya Kandekar

Updated on September 18, 2022

Comments

  • Aditya Kandekar
    Aditya Kandekar over 1 year

    Installed nvidia-440 drivers.

    $ sudo apt install nvidia-driver-440
    

    Then performed the following commands:

    sudo apt-key adv --fetch-keys  http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
    sudo bash -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list'
    sudo bash -c 'echo "deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda_learn.list'
    sudo apt update
    

    But after performing:sudo apt install cuda-10-1

    There were persistent errors regarding libnvidia-compute-450

    Errors:

     The following packages have unmet dependencies:
     cuda-drivers-450 : Depends: libnvidia-compute-450 (>= 450.36.06) but it is not installable
     libnvidia-decode-450 : Depends: libnvidia-compute-450 (= 450.36.06-0ubuntu1) but it is not installable
     nvidia-compute-utils-450 : Depends: libnvidia-compute-450 but it is not installable
     nvidia-driver-450 : Depends: libnvidia-compute-450 (= 450.36.06-0ubuntu1) but it is not installable
                         Recommends: libnvidia-compute-450:i386 (= 450.36.06-0ubuntu1) but it is not installable
                         Recommends: libnvidia-decode-450:i386 (= 450.36.06-0ubuntu1) but it is not installable
                         Recommends: libnvidia-encode-450:i386 (= 450.36.06-0ubuntu1) but it is not installable
                         Recommends: libnvidia-ifr1-450:i386 (= 450.36.06-0ubuntu1) but it is not installable
                         Recommends: libnvidia-fbc1-450:i386 (= 450.36.06-0ubuntu1) but it is not installable
                         Recommends: libnvidia-gl-450:i386 (= 450.36.06-0ubuntu1) but it is not installable
     nvidia-utils-450 : Depends: libnvidia-compute-450 but it is not installable
    E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
    

    Even after using following troubleshooting commands, the problem still persists.

    sudo dpkg ––configure –a
    sudo apt-get install –f
    sudo apt remove --autoremove nvidia-cuda-toolkit
    sudo apt-get clean
    sudo apt-get autoremove
    

    Also, suggest an appropriate method to install CUDA for deep-learning applications.