- Install CUDA 11.8
$ wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
$ sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
$ wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb
$ sudo dpkg -i cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb
$ sudo cp /var/cuda-repo-wsl-ubuntu-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
$ sudo apt-get update
$ sudo apt-get -y install cuda
- Install CUDNN 8.6.0 (Download from here first)
$ sudo apt-get install zlib1g
$ tar -xvf cudnn-linux-x86_64-8.6.0.163_cuda11-archive.tar.xz
$ sudo cp cudnn-*-archive/include/cudnn*.h /usr/local/cuda/include
$ sudo cp -P cudnn-*-archive/lib/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
- Run the command below in Windows Command Prompt as admin (Thanks to Roy Shilkrot) and restart your WSL2
> cd \Windows\System32\lxss\lib
> del libcuda.so
> del libcuda.so.1
> mklink libcuda.so libcuda.so.1.1
> mklink libcuda.so.1 libcuda.so.1.1
- Setup some WSL2 paths
$ echo 'export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
$ source ~/.bashrc
$ sudo ldconfig
- Update some dependencies
$ sudo apt update
$ sudo apt upgrade
- (Optional) Install Python 3.9.2 using pyenv
I used Python 3.9.2 for the exam, so I had to use pyenv in Ubuntu to not change Ubuntu's default Python. As for you, you can use Python 3.10.* and have no problem.
$ curl https://pyenv.run | bash
$ sudo apt install curl -y
$ sudo apt install git -y
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init - --path)"' >> ~/.bashrc
$ exec $SHELL
$ sudo apt install build-essential curl libbz2-dev libffi-dev liblzma-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev libxml2-dev libxmlsec1-dev llvm make tk-dev wget xz-utils zlib1g-dev
$ pyenv install 3.9.2
$ pyenv global 3.9.2
- Install TensorFlow 2.13
$ pip install --upgrade pip
$ pip install tensorflow==2.13
- Verify the GPU Setup
$ python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
If a list of GPU devices is returned, you've installed TensorFlow successfully.
@aros181 Are you using an RTX VGA and following the tutorial correctly?