How to modify this command to install specific cuDNN and torch version "apt install libcudnn8" – Apt

by
Ali Hasan
2captcha alpine-linux cuda ubuntu unix

Quick Fix: Replace the apt command with the following:

apt install libcudnn8=8.7.0.84-1+cuda11.8 libcudnn8-dev=8.7.0.84-1+cuda11.8

The Problem:

You want to install specific versions of cuDNN and PyTorch, but the standard apt command (apt install libcudnn8) installs different versions. Modify the command to specify the desired versions.

The Solutions:

Solution 1: Modifying apt install command for specific cuDNN and torch versions

To install specific versions of cuDNN and torch, you can modify the apt install command as follows:

apt install libcudnn8=${cudnn_version}-1+${cuda_version}
apt install libcudnn8-dev=${cudnn_version}-1+${cuda_version}
apt install libcudnn8-samples=${cudnn_version}-1+${cuda_version}

where:

  • ${cudnn_version} is the desired cuDNN version (e.g., 8.7.0)
  • ${cuda_version} is the desired CUDA version (e.g., cuda11.8)

For example, to install cuDNN version 8.7.0.84 with CUDA version 11.8, you would use the following commands:

apt install libcudnn8=8.7.0.84-1+cuda11.8
apt install libcudnn8-dev=8.7.0.84-1+cuda11.8
apt install libcudnn8-samples=8.7.0.84-1+cuda11.8

Note: If you are using RunPod, you can omit the sudo prefix since you are already logged in as the root user.

To find a list of available versions, run the following commands:

sudo apt update
sudo apt list -a libcudnn8-dev

Substitute the appropriate versions in the commands above to install the desired packages.

Solution 2: Specify the Version

To install a specific version of cuDNN and Torch, append the version number to the apt command.

For example, to install cuDNN 8.7.0 and Torch 1.12.1, use the following command:

apt install libcudnn8=8.7.0+cuda11.7 libcudnn8-dev=8.7.0+cuda11.7 torch=1.12.1+cu117 -y

Note:

  • Replace "8.7.0" with the desired cuDNN version.
  • Replace "11.7" with the desired CUDA version.

Q&A

in RunPod, how to install cudnn & cuda version ?

for RunPod, remove sudo and use apt version apt install libcudnn8=8.7.0.84-1+cuda11.8 libcudnn8-dev=8.7.0.84-1+cuda11.8

why doesn’t sudo apt-get install libcudnn8=8.9.4.25-1+cuda12.0 work?

use sudo apt-get install libcudnn8=8.9.4.25-1+cuda12.2 instead, check available libcudnn8 version in the url

Video Explanation:

The following video, titled "How To Install CUDA, cuDNN, Ubuntu, Miniconda | ML Software ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

Yes, Linux can revive your old PC. Surfshark Academy•17K views · 15 ... How to downgrade CUDA on Linux | Change CUDA versions for Torch/Tensorflow.