Print this article Edit this article

Setup TensorFlow in Windows Server with GPU

1. Create a conda environment

Open windows menu and find & click on "Anaconda Powershell Prompt (Anaconda3)":

Picture1.jpg

Create a new conda environment named tf with the following command.

conda create --name tf python=3.9

Picture2.jpg

You can deactivate and activate it with the following commands.

conda deactivate
conda activate tf

Make sure it is activated for the rest of the installation.

Picture3.jpg

2. GPU setup

Then install the CUDA, cuDNN with conda.

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

Picture4.jpg

3. Install TensorFlow

TensorFlow requires a recent version of pip, so upgrade your pip installation to be sure you're running the latest version.

python -m pip install --upgrade pip

Picture5.jpg

Then, install TensorFlow with pip.

Note: Do not install TensorFlow with conda. It may not have the latest stable version. pip is recommended since TensorFlow is only officially released to PyPI.

# Anything above 2.10 is not supported on the GPU on Windows Native
pip install "tensorflow<2.11"

Picture6.jpg

Picture7.jpg

If still for more than 2 min without returning to the prompt, hit ENTER.

Picture8.jpg

4. Verify the installation

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

Picture9.jpg

If a list of GPU devices is returned, you've installed TensorFlow successfully.

Last Modified: Feb 13, 2024 2:06 pm US/Eastern
Created: Feb 13, 2024 1:49 pm US/Eastern by calderon
JumpURL: