Categories
Machine Learning

Install Tensorflow, CUDA,Visual Studio 2022 in Windows 11 for GPU modelling

This tutorial will help you to run Tensorflow in Windows 11 to use GPU for modelling, with the latest Visual Studio, CUDA and latest drivers. In this case, I’m using RTX 3060Ti Lite Hashes and Python 3.7 – 3.10 for Windows. (I use Python 3.10.9)

TLDR;

We need to install

  • Clean Windows Installation and GPU drivers card
  • the Microsoft Visual C++ (MSVC) compiler 2022
  • the CUDA Toolkit 11.8
  • the cuDNN libraries
  • Install tensorflow

Pre-requisites

1. Windows fresh installation to remove the complexity of issues or bugs is recommended here. I did re-install my Windows 11 in this step

2. Instead of using Nvidia Geforce Experience, I uninstall the GPU drivers (back to Microsoft Basic) and use NVCleanstall to download my RTX 3060 drivers without others bloatware https://www.techpowerup.com/download/techpowerup-nvcleanstall/

3. I use Python 3.9 from Anaconda https://www.anaconda.com/products/distribution

First step

We need to install Microsoft Visual Studio 2022, which it will required by CUDA for integration. You can download the community version and check for C/C++ development installation

https://learn.microsoft.com/en-us/visualstudio/releases/2022/compatibility

Once its already installed in your desktop, then go for next step for install CUDA 11 (the latest version for Windows)

https://developer.nvidia.com/cuda-toolkit

When you completed this step, its halfway done!

Second step

Download the CUDNN via Conda

conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0

Third step

Now, we are ready to install tensorflow (If you are using Python 3.11, you may have issue with tensorflow pip installation)

python -m pip install "tensorflow<2.11"

Now, you can test the tensorflow now working using GPU RTX Nvidia.

python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

One reply on “Install Tensorflow, CUDA,Visual Studio 2022 in Windows 11 for GPU modelling”

Leave a Reply

Your email address will not be published.