Installing NVIDIA GPU driver on Ubuntu 22.04

Chandra sekar Veerappan
3 min readJul 2, 2023

--

Photo by Gabriel Heinzer on Unsplash

Recently, I have installed the TensorFlow on my Ubuntu workstation. It has RTX 3060 GPU with CUDA driver (11.5) /Driver Version: 510.108.03 installed. It was installed successfully. During the install using pip , though i have Anaconda installed and base enviroment is activated by default. i came to know, there is CUDA compatibility for the each TensorFlow version. Installed TF version 2.12

This post (https://www.tensorflow.org/install/source) to highlight few points.,One key point is the Python version. On my Conda base environment has 3.8.16. When Anaconda installed, i have deliberately chosen old version 2.4.0 with Python version 3.8. Due to earlier issue, a bit averse of new and latest version. That helped in this case.As seen in the compatibility list the latest version Python 3.8.x. I am not sure, the higher version of Python creates any issues or not.

Last week, my colleague installing the TensorFlow on GPU ( Nvidia RTX 1080 Ti) who has higher version of Python (3.10?) on his conda base environment. Though, he followed the instructions from the internet, can not get the pass the installation check and getting the usual error. ImportError: No module named tensorflow

python -c 'import tensorflow as tf; print(tf.__version__)'
dpkg -l |grep cuda-toolkit
CUDA version

After this TensorFlow, CUDA installed but sometime the TesnsorFlow does not recognise the GPU with “Skipping registering GPU devices….” message for the following command.

mport tensorflow as tf

print('TensorFlow Version : ',tf.__version__)
print('GPU Name : ',tf.config.list_physical_devices('GPU'))

I too, got this error. Later found, it is due to path issue. As explained here…It fixes the GPU not detected by TensorFlow.

https://stackoverflow.com/questions/75937134/tensorflow-2-12-wsl2-skipping-registering-gpu-devices-unable-to-detect-cudnn-fo

CUDNN_PATH=$(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/:$CUDNN_PATH/lib

Bonus point: After successful install of GPU driver, how to make sure local Jupyter notebook runs on GPU. Please check this link to set GPU for Jupyter notebook.

https://saturncloud.io/blog/how-to-run-jupyter-notebook-on-gpus/

--

--