GPU is not detected in Tensorflow!

I am using Windows server 2019 with the following specs:

  • NVIDIA GeForce RTX 3080 GPUs (10+10)
  • Processor: Intel Xeon Gold 6348 CPU @ 2,60GHz, 3.50GHz
  • RAM: 512 GB
  • NVIDIA driver version=511.65 CUDA Version: 11.6 Cudnn: 9.0.0 (I think it is wrong, I need to downgrade it to 8.9?)
  • Microsoft Visual Studio 2019

when I type nvidia-smi and nvcc-V both work. I created a virtual env and installed Python (3.8) and TensorFlow. However, when I try to use

print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))

The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead. Num GPUs Available: 0

I do not understand. Also, the link does not provide updated Cuda and Python versions in Windows. Do I need to downgrade everything? Cuda and drivers as well? How do I fix it?