PyTorch has CUDA Version=11.4 and torchvision has CUDA Version=11.8

I have somehow different cuda versions:
CUDA Driver Version / Runtime Version 11.4 / 11.8
And when following the installation in PyTorch for Jetson, I have received the following error:

Failed to load the custom YOLOv5 model. Error: Detected that PyTorch and torchvision were compiled with different CUDA versions. PyTorch has CUDA Version=11.4 and torchvision has CUDA Version=11.8. Please reinstall the torchvision that matches your PyTorch install.

Please share me some insights how to resolve this issue. Thanks a lot!!

Hi,

Have you manually updated the CUDA into 11.8?

To fix this, could you try to build the TorchVision again with CUDA 11.4?
Or please try the package shared in the below link:

Thanks

Thanks for replying, will using jp5/cu114 will still enable the GPU? Because I took it last time and it does not support GPU usage.
How can I update to 11.8? Will it then update the pip install torch torchvision --no-cache https://nvidia.box.com/shared/static/ssf2v7pf5i245fk4i0q926hy4imzs2ph.whl to 11.8 as well?

Hi,

Yes, the packages from jp5/cu114 have enabled the CUDA support.
You will need to build PyTorch and TorchVision from the source if CUDA 11.8 is preferred.

Thanks.

Hi,

I have tried installing from jp5/cu114, but it does not have cuda support.
How can I build pytorch? Is there a repo I can checkout?

Hi,

We have verified the package and it does have CUDA support.
Could you share how you install and test it?

You can find the build from source steps in the topic below:

Instructions
Build from Source

Thanks.

Hi,

you are talking something else. jp5/cu114 index → does not have CUDA support.

PyTorch for Jetson → does have CUDA support, but it has different CUDA Versions (see my post title).

What I want to have is the source code of pytorch in this tutorial PyTorch for Jetson (not the torchvision) and the way I can build it in my Jetson. Thanks.

Hi,

Here is what we get from the package of jp5/cu114:

$  md5sum torch-2.2.0-cp38-cp38-linux_aarch64.whl 
4b87aab800adafd81ff3b95ea0c5401e  torch-2.2.0-cp38-cp38-linux_aarch64.whl
$ python3 
Python 3.8.10 (default, Jan 17 2025, 14:40:23) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'2.2.0'
>>> torch.cuda.is_available()
True

The source code of PyTorch can be found below:
GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration.

Thanks.