AssertionError: Torch not compiled with CUDA enabled!

ive tried 3 times to install and setup pytorch and cuda and no matter how i go about install it there will be an error in the installation, im trying to use a 4090 on windows pro 64x and it keeps defaulting to cpu which should be fine on this system but i would like it to use cuda

Could you post the used install commands as well as the install log, please?

i pip installed py torch through their websites link i chose 11.8 pip stable , i manually installed the version of cuda my 4090 is usign which was 12.1 . when i try to install pytorch with just pip install pytorch it says the following ( note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pytorch
Running setup.py clean for pytorch
Failed to build pytorch
ERROR: Could not build wheels for pytorch, which is required to install pyproject.toml-based projects)
i have the latest drivers, could it be that im not installing it to a new environment?

It seems you are somehow trying to build PyTorch instead of just installing the binaries.
Since you didn’t post the install command I wouldn’t know what went wrong and how to fix it.