Can I install CUDA 9.0 on Ubuntu 20.04

I'm trying to build a docker container on my GPU enabled machine (RTX 2060) to run some object detection (darknet) code in. When using Ubuntu 18.04 I was able to build the docker file and run code without any problems, but since updating to Ubuntu 20.04 (and the CUDA drivers etc) I am getting the issue:

libcudart.so.9.0: cannot open shared object file: No such file or directory

My current system is: Ubuntu 20.04 NVIDIA-SMI 455.32.00 CUDA Version: 11.1

My question is, is it possible to install CUDA 9.0 on Ubuntu 20.04?

1

1 Answer

I have the same question with you and it took me many months to figure it out.

After attempting many methods, I would recommend using virtual environment to install cuda and cudnn. It is not necessary to download cuda and cudnn from Nvidia website.

Here are my steps to install tensorflow-gpu by miniconda, while other packages can be installed by pip in the virtual environment.

My current system: Ubuntu 20.04, nvidia-smi: driver 470.130.01, cuda 11.4 (Tips: this version is just the latest version of cuda you can install, not the cuda has already been installed)

The packages I want to install. python==3.6, tensorflow-gpu==1.12.0.

The specific versions of cuda and cudnn to match tensorflow-gpu=1.12 are cuda==9.0 and cudnn==7.6.5

conda create -n YourEnvironmentName python=3.6
conda activate YourEnvironmentName
conda install tensorflow-gpu==1.12.0

There is no need to install cuda or cudnn, because both of them are installed automatically by installing tensorflow-gpu.

You can check the versions of packages in your environment by the codes below.

conda list

You can also test whether tensorflow working by

python
import tensorflow as tf
print(tf.__version__)

If there is no other errors and just warnings or no message except the version of tensorflow. You finished installation.

Then, you can install other packages to complete the settings of virtual environment by pip install.

pip install scipy==1.0.0 matplotlib==3.0.2 librosa==0.6.2

Install the packages together can reduce the conflicts.

There might have some other error messages but not for cuda or cudnn, you can figure them out by google the errors. Most reasons of errors are the versions of packages confliction. You only need to uninstall the latest version and install the old version, which can fix them.

Finally, you can run the python file in this environment without any problems.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like