Cannot activate the GPU for tensorflow

Hi all,
i have meet a problem that i cannot activate tensorflow by GPU.
tf.config.list_physical_devices(‘GPU’) = [ ]
the version of tool and softare Condition as below

  1. Window 11, 22H2
  2. Nvidia Geforce RTX 3060Ti
  3. Hardware driver: 532.03
  4. Python: 3.10.9
  5. tensorflow:2.12.0
  6. Cuda: 12.1
  7. cuDNN: 8.9.1

not sure whether those version is compatible,
if the version is compatiable and also follow install process, can someone share any suggestion to activate the GPU for tensorflow.
thanks

The last version of Tensorflow to have GPU compatibiilty with Windows is 2.10 , newer versions will need tricks such as using Jupyter , Docker or WSL to access the GPU on Windows

@Alex_Lin,

not sure whether those version is compatible,

No, GPU support on native-Windows is only available for 2.10 or earlier versions, starting in TF 2.11 CUDA build is not supported for Windows.

For using Tensorflow GPU on windows, you will need to build/install Tensorflow in WSL2 or use tensorflow-cpu with TensorFlow-DirectML-Plugin.

Thank you!

Hi Chunduriv

should i have to downgrade cuda/cuDNN version for TF 2.11?
on the other hand, we try to pip install tensorflow-gpu ,but i get below error: subprocess-exited-with-error


Collecting tensorflow-gpu
Using cached tensorflow-gpu-2.12.0.tar.gz (2.6 kB)
Preparing metadata (setup.py) … done
Requirement already satisfied: python_version>“3.7” in c:\users\user\anaconda3\lib\site-packages (from tensorflow-gpu) (0.0.2)
Building wheels for collected packages: tensorflow-gpu
Building wheel for tensorflow-gpu (setup.py) … error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
Traceback (most recent call last):
File “”, line 2, in
File “”, line 34, in
File “C:\Users\User\AppData\Local\Temp\pip-install-i33omk_i\tensorflow-gpu_94f98365580a487ea63d546e15fdb54c\setup.py”, line 37, in
raise Exception(TF_REMOVAL_WARNING)
Exception:

  =========================================================
  The "tensorflow-gpu" package has been removed!

  Please install "tensorflow" instead.

  Other than the name, the two packages have been identical
  since TensorFlow 2.1, or roughly since Sep 2019. For more
  information, see: pypi.org/project/tensorflow-gpu
  =========================================================

how can i success to active my GPU function for tensorflow?
thanks

@Alex_Lin,

how can i success to active my GPU function for tensorflow?

Even TF 2.11 doesn’t work on Windows. Install TF 2.10 if you wish to use the GPU on Windows.

After creating a conda environment, you can follow below steps for GPU setup:

conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
python -m pip install tensorflow=2.10
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

For more details please refer to step by step instructions.

Collecting tensorflow-gpu
Using cached tensorflow-gpu-2.12.0.tar.gz (2.6 kB)
Preparing metadata (setup.py) … done
Requirement already satisfied: python_version>“3.7” in c:\users\user\anaconda3\lib\site-packages (from tensorflow-gpu) (0.0.2)
Building wheels for collected packages: tensorflow-gpu
Building wheel for tensorflow-gpu (setup.py) … error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
Traceback (most recent call last):
File “”, line 2, in
File “”, line 34, in
File “C:\Users\User\AppData\Local\Temp\pip-install-i33omk_i\tensorflow-gpu_94f98365580a487ea63d546e15fdb54c\setup.py”, line 37, in
raise Exception(TF_REMOVAL_WARNING)
Exception:

tensorflow-gpu has been removed. Please install tensorflow instead. The tensorflow package supports GPU accelerated operations via Nvidia CUDA. For more details please refer to tensorflow-gpu · PyPI

Thank you!

1 Like

Hi @chunduriv
million thanks for your comment, we successful install it.

“[PhysicalDevice(name=‘/physical_device:GPU:0’, device_type=‘GPU’)]”

and we can process tensorflow by GPU
thanks a lot~~

1 Like

thanks very much! I worked it your way and solved it