I want to share the procedure to work with your GPU with the new stable version of tensorflow 2.5 in case someone is having problems with the update.
I have noticed an improvement in training time.
According to official information
Install Anaconda with Python 3.9
Install the latest version of your GPU driver.
Install Cuda Toolkit 11.2.2
Download Cudnn 8.1.1
Now just copy the files inside from each Cudnn folder and paste into your Cuda folder, follow this example.
A. Copy \cuda\bin\cudnn*.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin.
B. Copy \cuda\include\cudnn*.h to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\include.
C. Copy \cuda\lib\x64\cudnn*.lib to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\lib\x64.
Go to your environment variables, Under “System Variables” click on “New” and create the CUDA PATH
Create a new conda environment
conda create --name TF-2.5 python=3.9
conda activate TF-2.5
- install tensorflow and libraries
pip install tensorflow
pip install tensorflow-datasets
pip install tensorflow-hub
pip install jupyter
pip install numpy
pip install matplotlib
pip install pandas
if you need to use jupyter notebook with the new version of python and tensorflow (very important)
conda install -c conda-forge ipykernel
- Register your environment
python -m ipykernel install --user --name TF-2.5 --display-name “Python 3.9 (Tensorflow 2.5)”
- Testing your environment
that’s all works completely fine for me.
Thanks for sharing, Ricardo. Just to confirm, is this Windows 10 21H1 or another version of Windows?
Hi Yarri, Your welcome! yes it’s that version.
from what folder conda should be run ?
When I run it from the default folder of cmd, error happens:
C:\WINDOWS\system32>conda create --name TF-2.5 python=3.9
‘conda’ is not recognized as an internal or external command,
operable program or batch file.
Thanks in advance.
Hi Sasha, Because you have to create the environment from the Anaconda Prompt (miniconda3) not from cmd.
Thank you very much, Ricardo.
What application corresponds to the Anaconda Prompt ?
I could not find it in the folders seemed relevant:
Thanks a lot, Ricardo. Now it works perfectly!
I cant use my GPU with tensorflow 2.4.0!
I have CUDA 11.0 with 8.0.4 compatible for cuda 11,
all works in python with interpreter (Conda python 3.7.6 with virtual env)
When process image it’s too slow! The GPU isn’t used… why??? What’s wrong? I lost 4 days to find the error… but all .DLL are loaded successfully, i can’t see any error
I show you my screenshot…
https ibb co /LpHtMwf (complete this link to view i can max put 2 link in this post)
This procedure works good with Tensorflow 2.6 just keep following the instructions.
Hi Ricardo . I followed the steps but it tells me that I don’t have a graphics card and I have an rtx 3060.
Python_version 3.9.16 (main, Jan 11 2023, 16:16:36) [MSC v.1916 64 bit (AMD64)]
Tensorflow GPU version: 2.11.0
Keras version: 2.11.0
Hub version: 0.12.0
TF Datasets version: 4.8.2
GPUs Available: 0
According to the current installation guide, TensorFlow support for GPUs under Windows ended with version 2.10. I’ve been able to use get around it by running my TensorFlow environment from a Docker image based on
Thank you ,that was helpful
To use Tensorflow 2.5 with a GPU device in a Conda environment on Windows 10, you’ll need to follow these steps:
- Install Anaconda: Download and install the latest version of Anaconda from the official website.
- Create a new Conda environment: Open the Anaconda Prompt and create a new Conda environment with Python 3.9 by running the following command:
conda create -n tf-gpu python=3.9
- Activate the new environment: Activate the new Conda environment by running the following command:
conda activate tf-gpu
- Install the necessary packages: Install Tensorflow 2.5, CUDA 11.2.2, and cuDNN 8.1.1 by running the following commands:
conda install tensorflow-gpu=2.5
conda install cudatoolkit=11.2.2
conda install cudnn=8.1.1
- Test the installation: Test the installation by running a simple Tensorflow program in the Conda environment. For example:
import tensorflow as tf
This should print the version of Tensorflow installed (2.5 in this case).
That’s it! You can now use Tensorflow 2.5 with a GPU device in a Conda environment on Windows 10.
Quick additional question about the differentiated cpu and gpu versions of current tensorflow. Will the gpu version revert to cpu if i the resources aren’t hooked up right?
I will try to do this tomorrow on a Alienware x15 with a mobile 3080. Using TF 2.5 with gpu. I have been going round and round and finally got the tensorflow (probably 2.1) to acknowledge that the GPU was there, but it wouldn’t really use it. We shall see. Thanks for the help. On the CUDA and cuDNN, do I have to go down to these older toolkits like 11 for cuda and 8 for cudnn?