Software & AppsOperating SystemLinux

How To Fix “Unable to Locate Package libcudnn8” Error in Ubuntu 18.04

Ubuntu 19

In this article, we will discuss how to fix the “Unable to locate package libcudnn8” error that you may encounter when trying to install libcudnn8 in Ubuntu 18.04. This error typically occurs when the package is not available in the default repositories of your Ubuntu system.

Quick Answer

To fix the "Unable to locate package libcudnn8" error in Ubuntu 18.04, you need to add the multiverse repository to your system. This repository contains the Nvidia CUDA Toolkit, which includes the libcudnn8 package. After adding the repository, update the package lists and install the Nvidia CUDA Toolkit using the sudo apt install nvidia-cuda-toolkit command. Finally, reboot your system to apply the changes.

Understanding the Error

The libcudnn8 package is a GPU-accelerated library from Nvidia that is used for deep neural networks. It is a part of the Nvidia CUDA Toolkit, which is not available in the default Ubuntu repositories. Therefore, when you try to install libcudnn8 without adding the necessary repositories, you will encounter the “Unable to locate package libcudnn8” error.

Prerequisites

Before we proceed with the solution, ensure that you have the proprietary Nvidia graphics driver installed on your system. If not, you can install it using the following command:

sudo ubuntu-drivers autoinstall

This command will automatically detect and install the best drivers for your system. After running this command, you should reboot your system using sudo reboot.

Solution: Adding the Multiverse Repository

To resolve the “Unable to locate package libcudnn8” error, you need to add the multiverse repository to your Ubuntu system. The multiverse repository contains software that is not free, which includes the Nvidia CUDA Toolkit.

Step 1: Update the Package Lists

Firstly, update the package lists for the software that is installed on your system:

sudo apt update

The sudo command is used to run the following command with root privileges. The apt command is used for handling packages in Ubuntu. The update option is used to resynchronize the package index files from their sources.

Step 2: Add the Multiverse Repository

Next, add the multiverse repository to your system:

sudo add-apt-repository multiverse

The add-apt-repository command is used to add a repository to your system. The multiverse option is the name of the repository that you want to add.

Step 3: Update the Package Lists Again

After adding the multiverse repository, update the package lists again:

sudo apt update

Step 4: Install the Nvidia CUDA Toolkit

Now, you can install the Nvidia CUDA Toolkit, which includes the libcudnn8 package:

sudo apt install nvidia-cuda-toolkit

The install option is used to install a package. The nvidia-cuda-toolkit is the name of the package that you want to install.

Step 5: Reboot Your System

Finally, reboot your system to apply the changes:

sudo reboot

Conclusion

After following these steps, you should have successfully installed the libcudnn8 package and resolved the “Unable to locate package libcudnn8” error. If you encounter any further issues, ensure that the multiverse repository is properly enabled in your Ubuntu Software options.

For more information about the Nvidia CUDA Toolkit and libcudnn8, you can visit the official Nvidia website here.

Remember, the provided steps assume that you are using Ubuntu 18.04 and have the necessary hardware and drivers to support CUDA. If you are using a different version of Ubuntu or do not have the necessary hardware or drivers, you may need to follow different steps.

Can I install `libcudnn8` without adding the multiverse repository?

No, the libcudnn8 package is not available in the default Ubuntu repositories. You need to add the multiverse repository to your system in order to install it.

How do I install the proprietary Nvidia graphics driver?

You can install the proprietary Nvidia graphics driver by running the command sudo ubuntu-drivers autoinstall. This command will automatically detect and install the best drivers for your system. After running this command, remember to reboot your system using sudo reboot.

What is the purpose of the Nvidia CUDA Toolkit?

The Nvidia CUDA Toolkit is a software development kit provided by Nvidia that allows developers to utilize the power of Nvidia GPUs for general-purpose computing. It includes libraries, tools, and APIs for GPU-accelerated computing.

How can I check if the multiverse repository is enabled on my system?

You can check if the multiverse repository is enabled on your system by opening the "Software & Updates" application in Ubuntu. Go to the "Ubuntu Software" tab and make sure that the "Community-maintained free and open-source software (universe)" and "Proprietary drivers for devices (restricted)" options are checked. This will enable the multiverse repository.

Can I use these steps for a different version of Ubuntu?

These steps are specifically for Ubuntu 18.04. The process may vary for different versions of Ubuntu. It is recommended to refer to the official documentation or resources specific to your version of Ubuntu for accurate instructions.

Leave a Comment

Your email address will not be published. Required fields are marked *