Search code examples
python-3.xtensorflowanacondacudnn

No matching distribution found in the installation of the cuDNN for TensorFlow v2.12 in Anaconda


I have tried to install TensorFlow v2.12 in Anaconda with Python 3.9.16 and Windows 10 OS with pip v23.0.1. I need Tensforflow v2.12 for my GPU (RTX4080), and only this version works with my GPU, because support Cuda Toolkit v11.8, which is the oldest to support Ada Lovelace GPUs.

The official tensorflow.org for Windows OS provides the following installation instructions.

  1. conda install -c conda-forge cudatoolkit=11.8.0
  2. python3 -m pip install nvidia-cudnn-cu11==8.6.0.163 tensorflow==2.12.*
  3. CUDNN_PATH=$(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))
  4. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/:$CUDNN_PATH/lib

Verify install:

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

In the above steps, Cuda Toolkit 11.8.0 and Tensorflow 2.12 are installed without any problems. However, if I try the cuDNN 8.6.0.163 installation, not installed, and give the following result.

Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
ERROR: Could not find a version that satisfies the requirement nvidia-cudnn-cu11==8.6.0.163 (from versions: 0.0.1.dev5, 2021.10.26, 2021.11.18, 2021.12.8, 2022.1.13, 2022.4.2, 2022.5.19)
ERROR: No matching distribution found for nvidia-cudnn-cu11==8.6.0.163

What is going wrong? Is there any idea on how to install the cuDNN 8.6.0.163?

I tried to install cuDNN 8.6.0.163 in the following ways and all gave the same result:

  • python -m pip install nvidia-cudnn-cu11==8.6.0.163 (python in my conda environment is v3.9.16 so python3 command is not exist, it is the same with python. I have check it with: python --version)
  • pip install nvidia-cudnn-cu11==8.6.0.163
  • python -m pip install nvidia-cudnn-cu11==8.6.0.163 --no-cache-dir
  • python -m pip install nvidia-cudnn-cu11==8.6.0.163 --proxy="xxx.xxx.xxx.xxx:xxxx" (where xxx.xxx.xxx.xxx:xxxx some proxy IPs and corresponding port)

Additionally, I have install 'nvidia-pyindex': pip install nvidia-pyindex, but this does not solve the problem.

After all this, I have tried to install the cuDNN 8.6.0.163 version in Windows environment, and I have set the proper environmental variables, but Tenrosflow in Anaconda does not see that, etc.: print(tf.config.list_physical_devices('GPU'))

return nothing: [ ]

and from step 3, I have check this:

python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)

where this return:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'nvidia'

In PowerShell:

nvidia-smi return this:

"NVIDIA-SMI 531.41 | Driver Version: 531.41 | CUDA Version: 12.1"

and nvcc -V return this:

nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Sep_21_10:41:10_Pacific_Daylight_Time_2022 Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0


Solution

  • The problem here is you are trying to have GPU support with TensorFlow 2.12 in Windows OS. But TensorFlow has stopped GPU support after TF 2.10 version in native Win OS as per this doc where it has mentioned:

    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

    So please try again by either downgrading the TensorFlow 2.10 and install compatible CUDA 11.2 and cuDNN 8.1 as mentioned in this tested build configuration or can use WSL2 or directML plugin to have GPU support with tensorflow in your system.