Old cuda version for lastest pytorch

I have a docker machine which limits the cuda version at 11.7, if I still want to install pytorch 2.1 which requires cuda11.8, can I use conda to install cudatoolkit-11.8 for a walkaround? I tried but it failed, I don’t know if I should set some environtment variable or something

Your locally installed CUDA toolkit won’t be used unless you build PyTorch from source or custom CUDA extensions, since the PyTorch binaries ship with their own runtime dependencies.