How to deploy a pytorch detector built by pyinstaller in ubuntu to another host with cuda of different version

I build a pytorch detector in ubuntu using pyinstaller by the command:
pyinstaller --onefile --name=start_dector
The version of cuda on the host is 11.8. And I want to deploy the built file start_dector to another host where cuda10.2 installed. It can execute normally by running on GPU. but if I want to run on GPU, it report an warning msg:
torch/cuda/ UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 803: system has unsupported display driver / cuda driver combination (Triggered internally at /opt/conda/conda-bld/pytorch_1695392026823/work/c10/cuda/CUDAFunctions.cpp:108.)
return torch._C._cuda_getDeviceCount() > 0

And it failed to run on GPU. I also tried to copy the file of version 11.8 to the directory where start_dector is located, but it didn’t work

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 CUDA dependencies. You would need to install an NVIDIA driver, which supports the corresponding CUDA runtime libraries.

it seems that nvidia driver support cuda is a component of cuda toolkit and it can not install standalonely. So I uninstall the old cuda toolkit and install cuda toolkit v11.8. But it also didn’t work after that and the result was no change.

The CUDA toolkit has the option to install the driver. However, you can download and install the NVIDIA driver standalone.

Thank you for your help. The version of nvidia driver in src host is 535.98. I found no CUDA toolkit on nvidia’s webside contains the same version of cuda. So I tried the driver of version 535.104.05 but it didn’t work. Where can I get nvidia cuda driver of version 535.98 from?

You wouldn’t need the exactly same driver version and should check the compatibility matrix here.