Detected CUDA version (11.7) mismatches the version that was used to compile PyTorch (10.2)

Hi
I am trying to install packages for training a network and I receive the following error:
RuntimeError:
The detected CUDA version (11.7) mismatches the version that was used to compile
PyTorch (10.2). Please make sure to use the same CUDA versions.

ubuntu 20.04.4 LTS
CUDA Version: 11.7
torch 1.11.0
GPU NVIDIA RTX A4000

This issue is raised if your local CUDA toolkit (11.7) doesn’t match the used CUDA runtime from PyTorch (10.2).
Since you are using an Ampere GPU you would need to use CUDA >=11.0 and the 10.2 runtime won’t even work.
Make sure to use the PyTorch binaries with CUDA 11 and try to rebuild.
If you are hitting this issue during a build of a 3rd party library, check if they are using a requirement of a specific torch version and are downloading the CUDA 10.2 runtime in the background.