WSL2 tensorflow install not working
Hi @Syndicateeee ,

Could you please confirm the installation command you have used ? Is it `python3 -m pip install tensorflow[and-cuda]` ??

Also please note that above command will fetch the required cuda,cudnn libraries automatically. So please don't install any cuda libraries separately as it seems duplicating the registries. Only you need to install suitable CUDA driver manually and then all required CUDA toolkit shall be imported along with tensorflow if used above command.

Thank you.
 @SuryanarayanaY yes this is the exact command, i also tried it with docker desktop on windows and docker in wsl2. windows wont boot at all which is fine probably misconfigured and wsl2 also yields the same error. @Syndicateeee ,

I hope you have deleted any CUDA libraries that is installed manually except those bundled with tensorflow[and-cuda].Please confirm. Because multiple libraries may cause ambiguity.

I expect nvidia driver has been installed and running.Please share `nvidia-smi` command output.

Please share the environment details using `pip list` .

I am attaching a relevant issues here #57663 for verifying.






 I managed to resolve the issue. Note that im not sure what the issue was in the end. This worked for tensorflow 2.14
My steps to solving it:
1. installed Ubuntu 20.04 LTS
2. disable nouveau driver [https://askubuntu.com/a/951892](url)
3. install cudaToolkit 11.8 using the .run local installer [https://developer.nvidia.com/cuda-11-8-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=runfile_local](url)
4. add cuda path to PATH and LD_LIBRARY_PATH [https://forums.developer.nvidia.com/t/path-ld-library-path/48080](url)
5. install cudnn 8.6 using the installation guide [https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#installlinux-deb](url)
6. check if cuda is working `nvcc --version`
7. check if cudnn is working as stated in the install guide. 
7.1. if you get an error about FreeImage not being setup correctly [https://forums.developer.nvidia.com/t/freeimage-is-not-set-up-correctly-please-ensure-freeimae-is-set-up-correctly/66950/2?u=tschm300](url)
7.2. If you get an error stating somethin about "compute_35" go to cudnn_samples_v8 folder edit the samples common file `sudo nano samples_common.mk ` and at the end where it says `SMS ?=` remove 35 and save.
7.3. if your test passes you have installed cuda and cudnn
8. install anaconda [https://docs.anaconda.com/free/anaconda/install/linux/](url)
9. create anacona environment using `conda create --name tensorflow_001 -c conda-forge python=3.11
`
10.  activate conda environment `conda activate tensorflow_001`
11. install tensorflow using `python3 -m pip install tensorflow[and-cuda]`
12. done (note: some infos may be still there) Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62095">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62095">No</a>
 Hello, 

I'm experiencing the same issue and  I have  already posted in details what I'm dealing with in this [comment](https://github.com/tensorflow/tensorflow/issues/62075#issuecomment-1766011448)

Error:
Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered.
Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered.
Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered.

OS: Windows 11, WSL 2, Ubuntu 22.04.3 LTS
CUDA Version: 11.8 
CUDNN: 8.7

I have installed both CUDA and cudnn on WSL globally and then I used anaconda to download TF in a certain env.

In a weird way Tensorflow has worked when I used python 3.11 in my env, but then it downloaded TF 2.13, not 2.14, with one warning: tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT.

However, when I used python 3.10 in my env, it downloaded TF 2.14 BUT with the errors above.

Note: I have already followed the instructions from CUDA and Cudnn very carefully, And used a conda en @FaisalAlj 
1. i use cuDNN 8.6
2. for me installing the 11.8 toolkit wasnt enough, i also needed a NVIDIA driver with cuda 11.8 which is 520.61.05
3. this driver only worked on Ubuntu 20.04 supposedly because of the newer Ubuntu kernel in 22.04
4. I gave up on WSL2, went to a close by electronics store, bought a 500gig nvme and installed ubuntu on there
5. If you ensist on using wsl2 please give my guide a shot [https://github.com/tensorflow/tensorflow/issues/62095#issuecomment-1763366758](url)
You can setup ubuntu 20.04 on wsl2 using `wsl --install -d Ubuntu-20.04` also make sure ur using wsl2 not wsl so after u install `wsl --set-version Ubuntu-20.04 2` not sure if you can install the driver on wsl tho might look for the same nvidia driver for your windows host. When typing `nvidia-smi` in ur terminal it should say CUDA: 11.8.
### Issue type

Build/Install

### Have you reproduced the bug with TensorFlow Nightly?

No

### Source

source

### TensorFlow version

v2.14.0-rc1-21-g4dacf3f368e 2.14.0

### Custom code

Yes

### OS platform and distribution

Linux Ubuntu 22.04.1 on WSL2

### Mobile device

_No response_

### Python version

3.10.12

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

CUDA: 12.2 cudnn: ??

### GPU model and memory

rtx 3090 24gb 

### Current behavior?

Im trying to use tensorflow 2 on wsl2. I did the installation as in the tf docs.
After Installing tensorflow on wsl2 and running a test script as stated in the relevant code.

I get this some errors.

I have tried training a simple model with resnet which, at first, didnt work because cudnn was missing. After manually installing cudnn it worked but it feels so sketchy given that it should work without having to install it manually.

Also when I train my model (i dont know if this is normal behaviour) only my vram is used, the compute power of my gpu seems to not be used at all when i look at my taskmanager.


### Standalone code to reproduce the issue

```shell
import tensorflow as tf
tf.test.is_built_with_cuda()
```


### Relevant log output

```shell
2023-10-11 22:19:14.589975: 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
2023-10-11 22:19:14.590010: 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
2023-10-11 22:19:14.590032: 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
2023-10-11 22:19:14.593224: 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 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
/usr/lib/python3/dist-packages/scipy/__init__.py:146: UserWarning: A NumPy version >=1.17.3 and <1.25.0 is required for this version of SciPy (detected version 1.26.0
  warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
```
