Installing Latest TensorFlow version with CUDA, cudNN and GPU support - Step by step tutorial 2021
Why Stack Overflow recommends it
Stack Overflow users link it when a TensorFlow install does not see the GPU and they need a clean walkthrough of matching CUDA, cuDNN and Python versions.
Recommended by 4 people across 4 different months, 2021 to 2024.
What it is
A short step-by-step tutorial by Aladdin Persson on setting up TensorFlow 2.4 with GPU support on Windows 10. It covers installing Visual Studio, the NVIDIA CUDA Toolkit, cuDNN, a matching Python version in a conda environment, and then TensorFlow via pip.
What people said
Recommends Emil Walleser · 2021-02 · Stack Overflow · on “Python 3.8.8 Jupyter notebook kernel dies when I call model.fit() when I try to use my GPU”
I am going to answer my own question rather than deleting this because maybe someone else will be making the same simple mistake I was. The main mistake I made was having the incorrect CUDA download. you can refer to the what versions are correct at this link: [LINK] TLDR: Just follow this video: [this video] This also highlighted the importance of a virtual environment where you control the package versions to prevent incompatibilities.
Recommends Brett S · 2021-07 · Stack Overflow · on “Why are the models in the tutorials not converging on GPU (but working on CPU)?”
Ok I got it working, thanks to @phe who suggested that my installation was faulty in a comment. Here's what I did: Uninstalled CUDA In control panel I uninstalled everything CUDA 11.2 I deleted the folder at because the uninstallers didn't C:\Program Files\NVIDIA GPU Computing Toolkit Re-install CUDA and cudNN (following this video [this video] ) Using this table I determined which version of CUDA and cudNN to install [LINK] Download the appropriate CUDA [LINK] and cudNN [LINK] versions Install CUDA Extract downloaded cudNN zip and copy the bin , include , and lib subfolders to where CUDA installed (for me this was C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2 ) this should put the ite
Recommends Brett S · 2021-07 · Stack Overflow · on “Why are the models in the tutorials not converging on GPU (but working on CPU)?”
Ok. I'm going to uninstall cuda 11.2 in control center and by deleting `C:\Program Files\NVIDIA GPU Computing Toolkit` and then reinstalling by following this tutorial [this video] -- will update
Recommends Marek Vajda · 2022-03 · Stack Overflow · on “Tensorflow not running on GPU”
If you have problems running Tensorflow in the GPU, you should check if you have good / any versions of CUDA and cuDNN installed. These versions should be ideally exactly the same as those tested to work by the devs here [LINK] . For example for tensorflow==2.8.0 you should have CUDA v11.2 and cuDNN v8.1 . Also, you should add CUDA /bin folder and /libnvvp to system PATH. This answer is based on this tutorial Tensorflow 2021 install tutorial [this video] .
Recommends Marie · 2022-10 · Stack Overflow · on “Raw kernel process exited code: 3221226505”
I was working on my notebook using visual studio code, and training the model for the X times felt long. So I decided I should try train them using GPU instead of GPU. I follow this tutorial : [this video] Which basically is very similar than what you can find in tensorflow docs. You have to : Download and install Nvidia CUDA Toolkit (here 11.x) Download cuDNN Extract its content in the same folder as the CUDA Toolkit Add 2 vars in the path variable. After this operation, I restarted my computer and I was able to see my GPU when I was doing : print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU'))) Sadly every time a training or a predict cell was run, I was getting an error : C
Cites JE17 · 2022-12 · Stack Overflow · on “getting tensorflow to run on GPU”
I've been trying to get this to work forever and still no luck I have: GTX 1050 Ti (on Lenovo Legion laptop) the laptop also has an Intel UHD Graphics 630 (i'm not sure if maybe this is interfering?) Anaconda Visual Studio Python 3.9.13 CUDA 11.2 cuDNN 8.1 I added these to the PATH: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\libnvvp finally I installed tensorflow and created its own environment and I still can't get it to read my GPU basically followed [this video] AND I'm still having no luck. from tensorflow.python.client import device_lib print(device_lib.list_local_devices()) yields only information on the CPU Can anyo
Cites Chris Rahmé · 2023-01 · Stack Overflow · on “Tensorflow / CUDA: GPU not detected”
I have two Windows 11 laptops with NVIDIA GeForce RTX 3060 GPUs, which I want to run Tensorflow on. If that matters, both laptops are Lenovo Legion 5 laptops with "GPU Working Mode" set to "Hybrid-Auto Mode". The first laptop has the following setup: Python 3.10.7 Tensorflow 2.9.1 CUDA 11.2.0 cuDNN 8.1.1 CPU AMD Ryzen 7 6800H GPU0 NVIDIA GeForce RTX 3060 GPU1 AMD Radeon Graphics The second laptop has the following setup: Python 3.10.9 Virtual Environment Tensorflow 2.11.0 CUDA 11.2.2 cuDNN 8.1.1 CPU Intel Core i7 12th Gen 12700H GPU0 Intel Iris Xe GPU1 NVIDIA GeForce RTX 3060 CUDA and cuDNN were installed as per this video: [this video] (except for the conda part). On the first laptop, everything
Cites Crazy Engineer · 2023-01 · Stack Overflow · on “Tensorflow attempting to load wrong version of cupti.dll”
I am trying to use TensorFlow with Cuda but I am facing a problem. I am using: Python 3.9 Tensorflow 2.10.0 Tensorflow_gpu 2.5.0 And for CUDA: nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2020 NVIDIA Corporation Built on Mon_Nov_30_19:15:10_Pacific_Standard_Time_2020 Cuda compilation tools, release 11.2, V11.2.67 Build cuda_11.2.r11.2/compiler.29373293_0 According to Tensorflow - Build from source on Windows [LINK] , those versions should be compatible. But as soon as I run my training, I get the following Warning: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cupti64_112.dll'; dlerror: cupti64_112.dll not found 202
Cites Jerome Palayoor · 2023-02 · Stack Overflow · on “ImportError: cannot import name 'OrderedDict' from 'typing'”
C:\Users\jpala\.conda\envs\tf\python.exe C:\Users\jpala\Documents\ML\train.py Traceback (most recent call last): File "C:\Users\jpala\Documents\ML\train.py", line 5, in <module> import tensorflow as tf File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\__init__.py", line 37, in <module> from tensorflow.python.tools import module_util as _module_util File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\__init__.py", line 42, in <module> from tensorflow.python import data File "C:\Users\jpala\.conda\envs\tf\lib\site-packages\tensorflow\python\data\__init__.py", line 21, in <module> from tensorflow.python.data import experimental File "C:\Users\jpala\.conda\envs
Cites ymmx · 2023-02 · Stack Overflow · on “How make tensorflow use GPU?”
I'm working with python and I would like to use tensorflow with my GTX2080TI but tensorflow is using only the CPU. when I ask for device on my computer, it always return an empty list: In [3]: tf.config.list_physical_devices('GPU') Out[3]: [] I try this post: How do I use TensorFlow GPU? [LINK] but I don't use cuda and the tennsorflow-gpu seems outdated. I also try this well done tutorial [this video] without success. I install the card drivers, CUDA and cudNN but I still get the same issue. I also unsinstall tensorflow and keras an install them again without success. I don't know how can I find what is missing or if I made something wrong. Python 3.10 Tensoflow version: 2.11.0 Cuda version: 11.2