WSL2 - TensorFlow Install Issue Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
Hi **@vatsalraicha** ,

Ensure Correct Installation of CUDA, cuDNN, and TensorRT:
CUDA and cuDNN: Make sure that CUDA and cuDNN are correctly installed and that TensorFlow can detect them. You have mentioned using CUDA 12.3 and cuDNN v8.6, which should be compatible with TensorFlow 2.15.0. Ensure that the CUDA and cuDNN paths are correctly added to your `PATH` and `LD_LIBRARY_PATH` environment variables.
```
export PATH=/usr/local/cuda-12.3/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-12.3/lib64:$LD_LIBRARY_PATH
```
Reinstall TensorFlow:
Consider creating a fresh virtual environment and reinstalling TensorFlow within it. This can help resolve any conflicts or issues with previous installations:
```
python -m venv tf-venv
source tf-venv/bin/activate
pip install --upgrade pip
pip install tensorflow==2.15.0
```
Test Your Setup:
After ensuring all configurations and installations are correct, test your TensorFlow setup to see if it can access the GPU:
```
import tensorflow as tf

print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
```
Thank you!
 Same error. 

WSL version: 2.0.14.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.3235

NVIDIA GeForce RTX 4050
Driver Version: 551.61         CUDA Version: 12.4
CUDA sample functions run without errors

python 3.10.12
cuda_12.3.2_545.23.08
tensorrt 8.6.1

Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorrt
>>> print(tensorrt.__version__)
8.6.1
>>> import tensorflow as tf
2024-03-05 16:13:59.938649: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-03-05 16:13:59.960210: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-03-05 16:13:59.960255: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-03-05 16:13:59.960774: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-03-05 16:13:59.964109: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-03-05 16:14:00.340405: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
>>> print(tf.config.list_physical_devices('GPU'))
2024-03-05 16:14:19.162569: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-05 16:14:19.166217: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
2024-03-05 16:14:19.166261: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:887] could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
>>> print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
Num GPUs Available:  1
>>>

 @Venkat6871 On WSL2, I dont have CUDA 12.3 director in /usr/local.
So this path is invalid for me - /usr/local/cuda-12.3/
Now as per NVIDIA documentation, I don't need to install any drivers on WSL2 and it should automatically pick from native Windows.
What could be the next step for me here? Same problem Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered google colab error ,how to resolve it
 same 
2024-04-26 16:37:38.371348: E tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:9342] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-04-26 16:37:38.371404: E tensorflow/compiler/xla/stream_executor/cuda/cuda_fft.cc:609] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-04-26 16:37:38.371421: E tensorflow/compiler/xla/stream_executor/cuda/cuda_blas.cc:1518] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
 I have the same problem. I am using WSL2.
2024-04-25 16:44:46.357075: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-04-25 16:44:46.357110: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-04-25 16:44:46.357608: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
 After several days struggle,  I am able to get rid of this errors. 
It's a version compatibility issue. You need to install the package versions according to the [webpage](https://www.tensorflow.org/install/source#tested_build_configurations). 
I was struggled on installing specific CUDA toolkit versions through deb packages, because the version was always updated to the latest version 12.4. In the end, I used the runfiles to install the toolkit.
The other problem I had was that I started with tensorflow 2.15.1, which I could not get it to work. 
The versions that work for me are:
CUDA toolkit:  12.2. 
cudnn:             8.9.7.29
Tensorflow:      2.16.1
 @garryyan2 Did you achieve this on WSL2 or on Native Linux?
What was your CUDA version?
Would you be able to share the Version info that you have setup that works?
TensorRT Version: 
Nvidia Driver Version: 
NVIDIA-SMI Driver Version: 546.17
CUDA Version: 
CUDNN Version: 
Python Version (if applicable):
WSL version:  @vatsalraicha I am using WSL2. 

$nvcc --version 
has output:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Jun_13_19:16:58_PDT_2023
Cuda compilation tools, release 12.2, V12.2.91
Build cuda_12.2.r12.2/compiler.32965470_0

$nvidia-smi
has output
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.76.01              Driver Version: 552.22         CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
notice that the CUDA version is different from using command $nvcc --version.

cudnn version: 8.9.7.29
Python version: Python 3.10.12
WSL version: 5.15.146.1-microsoft-standard-WSL2

I am not sure about the TensorRT version.





 > same 2024-04-26 16:37:38.371348: E tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:9342] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered 2024-04-26 16:37:38.371404: E tensorflow/compiler/xla/stream_executor/cuda/cuda_fft.cc:609] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered 2024-04-26 16:37:38.371421: E tensorflow/compiler/xla/stream_executor/cuda/cuda_blas.cc:1518] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered

how did you solve it? I have the same problem in Colab @gurzelai, for me, I just tried difference version combinations of the tools/packages. I am not not familiar with Colab. You probably can't have the software versions of your choice. 
Facing this error message when trying to use tensorflow on WSL2 Ubuntu - Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered.
TF-TRT Warning: Could not find TensorRT
could not open file to read NUMA node: /sys/bus/pci/devices/0000:01:00.0/numa_node
Your kernel may have been built without NUMA support.

Environment
TensorRT Version: 8.6.1.6
GPU Type: 4080 Laptop GPU
Nvidia Driver Version: NVIDIA-SMI 546.17 Driver Version: 546.17
CUDA Version: 12.3, CUDA Toolkit Version - 11.8
CUDNN Version: v8.6
Operating System + Version: Windows 11
Python Version (if applicable): Python 3.10.13
TensorFlow Version (if applicable): 2.15.0
PyTorch Version (if applicable): N/A
Baremetal or Container (if container which image + tag): N/A
pyenv Version - 2.3.35-11-g9908daf8
WSL version: 2.0.14.0
Kernel version: 5.15.133.1-1

[tensorFlowErrors.txt](https://github.com/tensorflow/tensorflow/files/14475502/tensorFlowErrors.txt)

Steps to reproduce -
Followed the exact steps as mentioned in https://www.tensorflow.org/install/pip?hl=pt
