Tensorflow GPU Not working on Windows

I’m following the instructions exactly as provided on the “Install Tensorflow with pip” page at Install TensorFlow with pip. This is on Windows 10 Pro, using miniconda and python 3.9 (following the detailed instructions on the same page).

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

The GPU list comes up empty. Not sure what I’m missing. Everything installs fine and there are no errors. Tensorflow seems to work fine in CPU mode. Any suggestions or ways to troubleshoot?

Thanks in advance!

2 Likes

Which is the tensorflow version and also gives details about the GPU card?

Note: TensorFlow 2.10 was the last TensorFlow release that supported GPU on native-Windows. Starting with TensorFlow 2.11 , you will need to install TensorFlow in WSL2, or install tensorflow-cpu and, optionally, try the TensorFlow-DirectML-Plugin

Have you checked hardware_requirements?

Thank you!

1 Like

TensorFlow 2.11 and up won’t have GPU support under Windows. If you change the second line to
python -m pip install tensorflow==2.10
then that will give you the last version with GPU support.

If you’re okay using Jupyter notebooks for development, I was able to get the latest-gpu-jupyter version of the Docker container running under Docker for Windows. I don’t think that I’ll be able to get Pycharm on Windows to see that as a development environment though.

Thank you, I was using 2.11. The page does mention the version requirement but I guess I was confused because the instructions still include installing cuda and stuff. My GPU is an RTX 2080 Super btw.

So, starting with 2.11 we can only use gpu under WSL, meaning a Linux environment? Not natively on Windows any more? That seems like a strange choice for Windows.

Thank you. I can run the Jupyter image and it works fine. I guess because it currently uses 2.10. I’d prefer not having to use docker, wsl, and all the other pieces if possible.

Btw, you can use Pycharm with the docker jupyter setup. You just have to run the container and configure the jupyter notebook server URL shown at startup and configure that s the notebook server url in pycharm. It has some quirks but works well.

I was confused because the instructions still include installing cuda and stuff

Sorry for the confusion, PR has been created to update the document as shown below

    conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
    python3 -m pip install tensorflow
    # Anything above 2.10 is not supported on the GPU on Windows Native
    python3 -m pip install "tensorflow<2.11"
    # Verify install:
    python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

So, starting with 2.11 we can only use gpu under WSL, meaning a Linux environment?

Yes, TF is still going to be available via windows based linux kernel.

Thank you!

@VijayD,

Installing the Tensorflow GPU on Windows Native commands is updated.

Beginning with Tensorflow 2.11, support for GPU on native windows has changed. You can install tensorflow-cpu within windows machines or try the TensorFlow-DirectML-Plugin. Going forward, Tensorflow support will be developed and maintained by Tensorflow Official build collaborators (Intel, AWS, ARM, linaro etc.). For more details please refer to the link. Thank you!

Ok, looks like right now the DirectML plugin has issues with 2.11 as well but that probably needs to be addressed by their team. As long as there is a way to use tensorflow with gpu natively on windows without having to go through wsl/docker layers I think that would be still good for some users. Please make sure to continue to support this use case.

1 Like

Many thanks for this info!
Is there a rationale on why native Windows support for GPU is no longer offered in versions higher than 2.10? Many thanks!

I guess Windows has the smallest user base…

ugh such a bummer. What if I need the DLL with GPU support as a dependency of another software? I guess the only viable option would be downgrading the CUDA version.