Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talhaanwarch/fef287d327df7c12bfef91eb95bc6393 to your computer and use it in GitHub Desktop.
Save talhaanwarch/fef287d327df7c12bfef91eb95bc6393 to your computer and use it in GitHub Desktop.
5 Steps to Install PyTorch 2.0 and Tensorflow 2.12 on Ubuntu 22.04 with CUDA and cuDNN
Step1:
sudo apt update
sudo apt install build-essential
sudo apt-get install manpages-dev
sudo apt install gcc
Step2:
sudo sh cuda_11.8.0_520.61.05_linux.run
nano ~/.bashrc
export PATH=/usr/local/cuda-11.8/bin${PATH:+:${PATH}}$
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Step3:
tar -xvf cudnn-linux-x86_64-8.6.0.163_cuda11-archive.tar.xz
sudo cp cudnn-*-archive/include/cudnn*.h /usr/local/cuda-11.8/include
sudo cp -P cudnn-*-archive/lib/libcudnn* /usr/local/cuda-11.8/lib64
sudo chmod a+r /usr/local/cuda-11.8/include/cudnn*.h /usr/local/cuda-11.8/lib64/libcudnn*
Step4:
sudo apt install python3.10-venv
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -U setuptools wheel
Step5:
nvcc --version
pip install tensorflow==2.12.0
pip install torch torchvision torchaudio
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment